Changeset 175 for trunk/org.modelica.mdt.test/src/org/modelica/mdt/test
- Timestamp:
- 12/05/05 11:49:55 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt.test/src/org/modelica/mdt/test/TestOMCProxy.java
r171 r175 45 45 import java.util.Vector; 46 46 47 import org.eclipse.core.resources.IProject; 47 48 import org.modelica.mdt.internal.omcproxy.CompilerException; 49 import org.modelica.mdt.internal.omcproxy.ConnectionException; 50 import org.modelica.mdt.internal.omcproxy.ElementLocation; 51 import org.modelica.mdt.internal.omcproxy.InvocationError; 48 52 import org.modelica.mdt.internal.omcproxy.OMCProxy; 53 import org.modelica.mdt.internal.omcproxy.UnexpectedReplyException; 54 import org.modelica.mdt.test.util.Area51Projects; 55 import org.modelica.mdt.test.util.Utility; 49 56 50 57 import junit.framework.TestCase; … … 56 63 protected void setUp() 57 64 { 65 Area51Projects.createProjects(); 66 58 67 assertTrue(Collections.addAll(modelicaLibraryPackages, 59 68 "Mechanics", … … 66 75 "SIunits")); 67 76 } 77 78 /** 79 * test OMCProxy.getPackages() 80 */ 68 81 public void testGetPackages() 69 82 { … … 88 101 } 89 102 } 103 104 /** 105 * test OMCProxy.getElementLocation() 106 */ 107 public void testGetElementLocation() 108 throws ConnectionException, UnexpectedReplyException, InvocationError 109 { 110 /* load file nested_models.mo from Area51Projects modelica project */ 111 IProject proj = Utility.getProject( 112 Area51Projects.MODELICA_PROJECT_NAME).getProject(); 113 114 OMCProxy.loadFileInteractive(proj.getFile("nested_models.mo")); 115 116 /* 117 * we are basicaly only interested in getting the right line number 118 */ 119 ElementLocation loc = OMCProxy.getElementLocation("nested_models"); 120 assertTrue(loc.getPath().endsWith("nested_models.mo")); 121 assertEquals(loc.getLine(), 1); 122 123 loc = OMCProxy.getElementLocation("nested_models.hepp"); 124 assertEquals(loc.getLine(), 3); 125 126 loc = OMCProxy.getElementLocation("nested_models.foo"); 127 assertEquals(loc.getLine(), 4); 128 129 loc = OMCProxy.getElementLocation("nested_models.foo.bar"); 130 assertEquals(loc.getLine(), 5); 131 132 loc = OMCProxy.getElementLocation("muu"); 133 assertEquals(loc.getLine(), 8); 134 135 loc = OMCProxy.getElementLocation("foo"); 136 assertEquals(loc.getLine(), 14); 137 138 loc = OMCProxy.getElementLocation("hej"); 139 assertEquals(loc.getLine(), 19); 140 141 loc = OMCProxy.getElementLocation("hej.ine_paketen"); 142 assertEquals(loc.getLine(), 20); 143 144 loc = OMCProxy.getElementLocation("hej.hejhej"); 145 assertEquals(loc.getLine(), 22); 146 147 loc = OMCProxy.getElementLocation("hej.hejhej.foo"); 148 assertEquals(loc.getLine(), 23); 149 150 loc = OMCProxy.getElementLocation("hepp"); 151 assertEquals(loc.getLine(), 30); 152 153 loc = OMCProxy.getElementLocation("hepp.hopp"); 154 assertEquals(loc.getLine(), 31); 155 156 loc = OMCProxy.getElementLocation("hepp.hehehe"); 157 assertEquals(loc.getLine(), 33); 158 159 } 90 160 }
Note: See TracChangeset
for help on using the changeset viewer.