diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools')
3 files changed, 116 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 8b88588..65d3b9b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
118 | emessage = emessage.Substring(slinfo.Length+2); | 118 | emessage = emessage.Substring(slinfo.Length+2); |
119 | 119 | ||
120 | message = String.Format("({0},{1}) {2}", | 120 | message = String.Format("({0},{1}) {2}", |
121 | e.slInfo.lineNumber - 2, | 121 | e.slInfo.lineNumber - 1, |
122 | e.slInfo.charPosition - 1, emessage); | 122 | e.slInfo.charPosition - 1, emessage); |
123 | 123 | ||
124 | throw new Exception(message); | 124 | throw new Exception(message); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 63afb0b..7763619 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Text.RegularExpressions; | 29 | using System.Text.RegularExpressions; |
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 31 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
32 | using OpenSim.Tests.Common; | ||
32 | 33 | ||
33 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 34 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
34 | { | 35 | { |
@@ -43,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
43 | [Test] | 44 | [Test] |
44 | public void TestDefaultState() | 45 | public void TestDefaultState() |
45 | { | 46 | { |
47 | TestHelpers.InMethod(); | ||
48 | |||
46 | string input = @"default | 49 | string input = @"default |
47 | { | 50 | { |
48 | state_entry() | 51 | state_entry() |
@@ -63,6 +66,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
63 | [Test] | 66 | [Test] |
64 | public void TestCustomState() | 67 | public void TestCustomState() |
65 | { | 68 | { |
69 | TestHelpers.InMethod(); | ||
70 | |||
66 | string input = @"default | 71 | string input = @"default |
67 | { | 72 | { |
68 | state_entry() | 73 | state_entry() |
@@ -93,6 +98,8 @@ state another_state | |||
93 | [Test] | 98 | [Test] |
94 | public void TestEventWithArguments() | 99 | public void TestEventWithArguments() |
95 | { | 100 | { |
101 | TestHelpers.InMethod(); | ||
102 | |||
96 | string input = @"default | 103 | string input = @"default |
97 | { | 104 | { |
98 | at_rot_target(integer tnum, rotation targetrot, rotation ourrot) | 105 | at_rot_target(integer tnum, rotation targetrot, rotation ourrot) |
@@ -113,6 +120,8 @@ state another_state | |||
113 | [Test] | 120 | [Test] |
114 | public void TestIntegerDeclaration() | 121 | public void TestIntegerDeclaration() |
115 | { | 122 | { |
123 | TestHelpers.InMethod(); | ||
124 | |||
116 | string input = @"default | 125 | string input = @"default |
117 | { | 126 | { |
118 | touch_start(integer num_detected) | 127 | touch_start(integer num_detected) |
@@ -135,6 +144,8 @@ state another_state | |||
135 | [Test] | 144 | [Test] |
136 | public void TestLoneIdent() | 145 | public void TestLoneIdent() |
137 | { | 146 | { |
147 | TestHelpers.InMethod(); | ||
148 | |||
138 | // A lone ident should be removed completely as it's an error in C# | 149 | // A lone ident should be removed completely as it's an error in C# |
139 | // (MONO at least). | 150 | // (MONO at least). |
140 | string input = @"default | 151 | string input = @"default |
@@ -161,6 +172,8 @@ state another_state | |||
161 | [Test] | 172 | [Test] |
162 | public void TestAssignments() | 173 | public void TestAssignments() |
163 | { | 174 | { |
175 | TestHelpers.InMethod(); | ||
176 | |||
164 | string input = @"default | 177 | string input = @"default |
165 | { | 178 | { |
166 | touch_start(integer num_detected) | 179 | touch_start(integer num_detected) |
@@ -187,6 +200,8 @@ state another_state | |||
187 | [Test] | 200 | [Test] |
188 | public void TestAdditionSubtractionOperator() | 201 | public void TestAdditionSubtractionOperator() |
189 | { | 202 | { |
203 | TestHelpers.InMethod(); | ||
204 | |||
190 | string input = @"default | 205 | string input = @"default |
191 | { | 206 | { |
192 | touch_start(integer num_detected) | 207 | touch_start(integer num_detected) |
@@ -215,6 +230,8 @@ state another_state | |||
215 | [Test] | 230 | [Test] |
216 | public void TestStrings() | 231 | public void TestStrings() |
217 | { | 232 | { |
233 | TestHelpers.InMethod(); | ||
234 | |||
218 | string input = @"default | 235 | string input = @"default |
219 | { | 236 | { |
220 | touch_start(integer num_detected) | 237 | touch_start(integer num_detected) |
@@ -242,6 +259,8 @@ state another_state | |||
242 | [Test] | 259 | [Test] |
243 | public void TestBinaryExpression() | 260 | public void TestBinaryExpression() |
244 | { | 261 | { |
262 | TestHelpers.InMethod(); | ||
263 | |||
245 | string input = @"default | 264 | string input = @"default |
246 | { | 265 | { |
247 | touch_start(integer num_detected) | 266 | touch_start(integer num_detected) |
@@ -284,6 +303,8 @@ state another_state | |||
284 | [Test] | 303 | [Test] |
285 | public void TestFloatConstants() | 304 | public void TestFloatConstants() |
286 | { | 305 | { |
306 | TestHelpers.InMethod(); | ||
307 | |||
287 | string input = @"default | 308 | string input = @"default |
288 | { | 309 | { |
289 | touch_start(integer num_detected) | 310 | touch_start(integer num_detected) |
@@ -336,6 +357,8 @@ state another_state | |||
336 | [Test] | 357 | [Test] |
337 | public void TestComments() | 358 | public void TestComments() |
338 | { | 359 | { |
360 | TestHelpers.InMethod(); | ||
361 | |||
339 | string input = @"// this test tests comments | 362 | string input = @"// this test tests comments |
340 | default | 363 | default |
341 | { | 364 | { |
@@ -358,6 +381,8 @@ default | |||
358 | [Test] | 381 | [Test] |
359 | public void TestStringsWithEscapedQuotesAndComments() | 382 | public void TestStringsWithEscapedQuotesAndComments() |
360 | { | 383 | { |
384 | TestHelpers.InMethod(); | ||
385 | |||
361 | string input = @"// this test tests strings, with escaped quotes and comments in strings | 386 | string input = @"// this test tests strings, with escaped quotes and comments in strings |
362 | default | 387 | default |
363 | { | 388 | { |
@@ -397,6 +422,8 @@ default | |||
397 | [Test] | 422 | [Test] |
398 | public void TestCStyleComments() | 423 | public void TestCStyleComments() |
399 | { | 424 | { |
425 | TestHelpers.InMethod(); | ||
426 | |||
400 | string input = @"/* this test tests comments | 427 | string input = @"/* this test tests comments |
401 | of the C variety | 428 | of the C variety |
402 | */ | 429 | */ |
@@ -426,6 +453,8 @@ default | |||
426 | [Test] | 453 | [Test] |
427 | public void TestGlobalDefinedFunctions() | 454 | public void TestGlobalDefinedFunctions() |
428 | { | 455 | { |
456 | TestHelpers.InMethod(); | ||
457 | |||
429 | string input = @"// this test tests custom defined functions | 458 | string input = @"// this test tests custom defined functions |
430 | 459 | ||
431 | string onefunc() | 460 | string onefunc() |
@@ -470,6 +499,8 @@ default | |||
470 | [Test] | 499 | [Test] |
471 | public void TestGlobalDeclaredVariables() | 500 | public void TestGlobalDeclaredVariables() |
472 | { | 501 | { |
502 | TestHelpers.InMethod(); | ||
503 | |||
473 | string input = @"// this test tests custom defined functions and global variables | 504 | string input = @"// this test tests custom defined functions and global variables |
474 | 505 | ||
475 | string globalString; | 506 | string globalString; |
@@ -525,6 +556,8 @@ default | |||
525 | [Test] | 556 | [Test] |
526 | public void TestMoreAssignments() | 557 | public void TestMoreAssignments() |
527 | { | 558 | { |
559 | TestHelpers.InMethod(); | ||
560 | |||
528 | string input = @"// this test tests +=, -=, *=, /=, %= | 561 | string input = @"// this test tests +=, -=, *=, /=, %= |
529 | 562 | ||
530 | string globalString; | 563 | string globalString; |
@@ -579,6 +612,8 @@ default | |||
579 | [Test] | 612 | [Test] |
580 | public void TestVectorConstantNotation() | 613 | public void TestVectorConstantNotation() |
581 | { | 614 | { |
615 | TestHelpers.InMethod(); | ||
616 | |||
582 | string input = @"default | 617 | string input = @"default |
583 | { | 618 | { |
584 | touch_start(integer num_detected) | 619 | touch_start(integer num_detected) |
@@ -606,6 +641,8 @@ default | |||
606 | [Test] | 641 | [Test] |
607 | public void TestVectorMemberAccess() | 642 | public void TestVectorMemberAccess() |
608 | { | 643 | { |
644 | TestHelpers.InMethod(); | ||
645 | |||
609 | string input = @"default | 646 | string input = @"default |
610 | { | 647 | { |
611 | touch_start(integer num_detected) | 648 | touch_start(integer num_detected) |
@@ -632,6 +669,8 @@ default | |||
632 | [Test] | 669 | [Test] |
633 | public void TestExpressionInParentheses() | 670 | public void TestExpressionInParentheses() |
634 | { | 671 | { |
672 | TestHelpers.InMethod(); | ||
673 | |||
635 | string input = @"default | 674 | string input = @"default |
636 | { | 675 | { |
637 | touch_start(integer num_detected) | 676 | touch_start(integer num_detected) |
@@ -660,6 +699,8 @@ default | |||
660 | [Test] | 699 | [Test] |
661 | public void TestIncrementDecrementOperator() | 700 | public void TestIncrementDecrementOperator() |
662 | { | 701 | { |
702 | TestHelpers.InMethod(); | ||
703 | |||
663 | string input = @"// here we'll test the ++ and -- operators | 704 | string input = @"// here we'll test the ++ and -- operators |
664 | 705 | ||
665 | default | 706 | default |
@@ -690,6 +731,8 @@ default | |||
690 | [Test] | 731 | [Test] |
691 | public void TestLists() | 732 | public void TestLists() |
692 | { | 733 | { |
734 | TestHelpers.InMethod(); | ||
735 | |||
693 | string input = @"// testing lists | 736 | string input = @"// testing lists |
694 | 737 | ||
695 | default | 738 | default |
@@ -718,6 +761,8 @@ default | |||
718 | [Test] | 761 | [Test] |
719 | public void TestIfStatement() | 762 | public void TestIfStatement() |
720 | { | 763 | { |
764 | TestHelpers.InMethod(); | ||
765 | |||
721 | string input = @"// let's test if statements | 766 | string input = @"// let's test if statements |
722 | 767 | ||
723 | default | 768 | default |
@@ -822,6 +867,8 @@ default | |||
822 | [Test] | 867 | [Test] |
823 | public void TestIfElseStatement() | 868 | public void TestIfElseStatement() |
824 | { | 869 | { |
870 | TestHelpers.InMethod(); | ||
871 | |||
825 | string input = @"// let's test complex logical expressions | 872 | string input = @"// let's test complex logical expressions |
826 | 873 | ||
827 | default | 874 | default |
@@ -928,6 +975,8 @@ default | |||
928 | [Test] | 975 | [Test] |
929 | public void TestWhileLoop() | 976 | public void TestWhileLoop() |
930 | { | 977 | { |
978 | TestHelpers.InMethod(); | ||
979 | |||
931 | string input = @"// let's test while loops | 980 | string input = @"// let's test while loops |
932 | 981 | ||
933 | default | 982 | default |
@@ -968,6 +1017,8 @@ default | |||
968 | [Test] | 1017 | [Test] |
969 | public void TestDoWhileLoop() | 1018 | public void TestDoWhileLoop() |
970 | { | 1019 | { |
1020 | TestHelpers.InMethod(); | ||
1021 | |||
971 | string input = @"// let's test do-while loops | 1022 | string input = @"// let's test do-while loops |
972 | 1023 | ||
973 | default | 1024 | default |
@@ -1012,6 +1063,8 @@ default | |||
1012 | [Test] | 1063 | [Test] |
1013 | public void TestForLoop() | 1064 | public void TestForLoop() |
1014 | { | 1065 | { |
1066 | TestHelpers.InMethod(); | ||
1067 | |||
1015 | string input = @"// let's test for loops | 1068 | string input = @"// let's test for loops |
1016 | 1069 | ||
1017 | default | 1070 | default |
@@ -1056,6 +1109,8 @@ default | |||
1056 | [Test] | 1109 | [Test] |
1057 | public void TestFloatsWithTrailingDecimal() | 1110 | public void TestFloatsWithTrailingDecimal() |
1058 | { | 1111 | { |
1112 | TestHelpers.InMethod(); | ||
1113 | |||
1059 | string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot | 1114 | string input = @"// a curious feature of LSL that allows floats to be defined with a trailing dot |
1060 | 1115 | ||
1061 | default | 1116 | default |
@@ -1108,6 +1163,8 @@ default | |||
1108 | [Test] | 1163 | [Test] |
1109 | public void TestUnaryAndBinaryOperators() | 1164 | public void TestUnaryAndBinaryOperators() |
1110 | { | 1165 | { |
1166 | TestHelpers.InMethod(); | ||
1167 | |||
1111 | string input = @"// let's test a few more operators | 1168 | string input = @"// let's test a few more operators |
1112 | 1169 | ||
1113 | default | 1170 | default |
@@ -1144,6 +1201,8 @@ default | |||
1144 | [Test] | 1201 | [Test] |
1145 | public void TestTypecasts() | 1202 | public void TestTypecasts() |
1146 | { | 1203 | { |
1204 | TestHelpers.InMethod(); | ||
1205 | |||
1147 | string input = @"// let's test typecasts | 1206 | string input = @"// let's test typecasts |
1148 | 1207 | ||
1149 | default | 1208 | default |
@@ -1189,6 +1248,8 @@ default | |||
1189 | [Test] | 1248 | [Test] |
1190 | public void TestStates() | 1249 | public void TestStates() |
1191 | { | 1250 | { |
1251 | TestHelpers.InMethod(); | ||
1252 | |||
1192 | string input = @"// let's test states | 1253 | string input = @"// let's test states |
1193 | 1254 | ||
1194 | default | 1255 | default |
@@ -1229,6 +1290,8 @@ state statetwo | |||
1229 | [Test] | 1290 | [Test] |
1230 | public void TestHexIntegerConstants() | 1291 | public void TestHexIntegerConstants() |
1231 | { | 1292 | { |
1293 | TestHelpers.InMethod(); | ||
1294 | |||
1232 | string input = @"// let's test hex integers | 1295 | string input = @"// let's test hex integers |
1233 | 1296 | ||
1234 | default | 1297 | default |
@@ -1261,6 +1324,8 @@ default | |||
1261 | [Test] | 1324 | [Test] |
1262 | public void TestJumps() | 1325 | public void TestJumps() |
1263 | { | 1326 | { |
1327 | TestHelpers.InMethod(); | ||
1328 | |||
1264 | string input = @"// let's test jumps | 1329 | string input = @"// let's test jumps |
1265 | 1330 | ||
1266 | default | 1331 | default |
@@ -1291,6 +1356,8 @@ default | |||
1291 | [Test] | 1356 | [Test] |
1292 | public void TestImplicitVariableInitialization() | 1357 | public void TestImplicitVariableInitialization() |
1293 | { | 1358 | { |
1359 | TestHelpers.InMethod(); | ||
1360 | |||
1294 | string input = @"// let's test implicitly initializing variables | 1361 | string input = @"// let's test implicitly initializing variables |
1295 | 1362 | ||
1296 | default | 1363 | default |
@@ -1334,6 +1401,8 @@ default | |||
1334 | [Test] | 1401 | [Test] |
1335 | public void TestMultipleEqualsExpression() | 1402 | public void TestMultipleEqualsExpression() |
1336 | { | 1403 | { |
1404 | TestHelpers.InMethod(); | ||
1405 | |||
1337 | string input = @"// let's test x = y = 5 type expressions | 1406 | string input = @"// let's test x = y = 5 type expressions |
1338 | 1407 | ||
1339 | default | 1408 | default |
@@ -1366,6 +1435,8 @@ default | |||
1366 | [Test] | 1435 | [Test] |
1367 | public void TestUnaryExpressionLastInVectorConstant() | 1436 | public void TestUnaryExpressionLastInVectorConstant() |
1368 | { | 1437 | { |
1438 | TestHelpers.InMethod(); | ||
1439 | |||
1369 | string input = @"// let's test unary expressions some more | 1440 | string input = @"// let's test unary expressions some more |
1370 | 1441 | ||
1371 | default | 1442 | default |
@@ -1390,6 +1461,8 @@ default | |||
1390 | [Test] | 1461 | [Test] |
1391 | public void TestVectorMemberPlusEquals() | 1462 | public void TestVectorMemberPlusEquals() |
1392 | { | 1463 | { |
1464 | TestHelpers.InMethod(); | ||
1465 | |||
1393 | string input = @"// let's test unary expressions some more | 1466 | string input = @"// let's test unary expressions some more |
1394 | 1467 | ||
1395 | default | 1468 | default |
@@ -1424,6 +1497,8 @@ default | |||
1424 | [Test] | 1497 | [Test] |
1425 | public void TestWhileLoopWithNoBody() | 1498 | public void TestWhileLoopWithNoBody() |
1426 | { | 1499 | { |
1500 | TestHelpers.InMethod(); | ||
1501 | |||
1427 | string input = @"default | 1502 | string input = @"default |
1428 | { | 1503 | { |
1429 | state_entry() | 1504 | state_entry() |
@@ -1447,6 +1522,8 @@ default | |||
1447 | [Test] | 1522 | [Test] |
1448 | public void TestDoWhileLoopWithNoBody() | 1523 | public void TestDoWhileLoopWithNoBody() |
1449 | { | 1524 | { |
1525 | TestHelpers.InMethod(); | ||
1526 | |||
1450 | string input = @"default | 1527 | string input = @"default |
1451 | { | 1528 | { |
1452 | state_entry() | 1529 | state_entry() |
@@ -1472,6 +1549,8 @@ default | |||
1472 | [Test] | 1549 | [Test] |
1473 | public void TestIfWithNoBody() | 1550 | public void TestIfWithNoBody() |
1474 | { | 1551 | { |
1552 | TestHelpers.InMethod(); | ||
1553 | |||
1475 | string input = @"default | 1554 | string input = @"default |
1476 | { | 1555 | { |
1477 | state_entry() | 1556 | state_entry() |
@@ -1495,6 +1574,8 @@ default | |||
1495 | [Test] | 1574 | [Test] |
1496 | public void TestIfElseWithNoBody() | 1575 | public void TestIfElseWithNoBody() |
1497 | { | 1576 | { |
1577 | TestHelpers.InMethod(); | ||
1578 | |||
1498 | string input = @"default | 1579 | string input = @"default |
1499 | { | 1580 | { |
1500 | state_entry() | 1581 | state_entry() |
@@ -1521,6 +1602,8 @@ default | |||
1521 | [Test] | 1602 | [Test] |
1522 | public void TestForLoopWithNoBody() | 1603 | public void TestForLoopWithNoBody() |
1523 | { | 1604 | { |
1605 | TestHelpers.InMethod(); | ||
1606 | |||
1524 | string input = @"default | 1607 | string input = @"default |
1525 | { | 1608 | { |
1526 | state_entry() | 1609 | state_entry() |
@@ -1544,6 +1627,8 @@ default | |||
1544 | [Test] | 1627 | [Test] |
1545 | public void TestForLoopWithNoAssignment() | 1628 | public void TestForLoopWithNoAssignment() |
1546 | { | 1629 | { |
1630 | TestHelpers.InMethod(); | ||
1631 | |||
1547 | string input = @"default | 1632 | string input = @"default |
1548 | { | 1633 | { |
1549 | state_entry() | 1634 | state_entry() |
@@ -1569,6 +1654,8 @@ default | |||
1569 | [Test] | 1654 | [Test] |
1570 | public void TestForLoopWithOnlyIdentInAssignment() | 1655 | public void TestForLoopWithOnlyIdentInAssignment() |
1571 | { | 1656 | { |
1657 | TestHelpers.InMethod(); | ||
1658 | |||
1572 | string input = @"default | 1659 | string input = @"default |
1573 | { | 1660 | { |
1574 | state_entry() | 1661 | state_entry() |
@@ -1594,6 +1681,8 @@ default | |||
1594 | [Test] | 1681 | [Test] |
1595 | public void TestAssignmentInIfWhileDoWhile() | 1682 | public void TestAssignmentInIfWhileDoWhile() |
1596 | { | 1683 | { |
1684 | TestHelpers.InMethod(); | ||
1685 | |||
1597 | string input = @"default | 1686 | string input = @"default |
1598 | { | 1687 | { |
1599 | state_entry() | 1688 | state_entry() |
@@ -1631,6 +1720,8 @@ default | |||
1631 | [Test] | 1720 | [Test] |
1632 | public void TestLSLListHack() | 1721 | public void TestLSLListHack() |
1633 | { | 1722 | { |
1723 | TestHelpers.InMethod(); | ||
1724 | |||
1634 | string input = @"default | 1725 | string input = @"default |
1635 | { | 1726 | { |
1636 | state_entry() | 1727 | state_entry() |
@@ -1653,9 +1744,12 @@ default | |||
1653 | } | 1744 | } |
1654 | 1745 | ||
1655 | [Test] | 1746 | [Test] |
1656 | [ExpectedException(typeof(System.Exception))] | ||
1657 | public void TestSyntaxError() | 1747 | public void TestSyntaxError() |
1658 | { | 1748 | { |
1749 | TestHelpers.InMethod(); | ||
1750 | |||
1751 | bool gotException = false; | ||
1752 | |||
1659 | string input = @"default | 1753 | string input = @"default |
1660 | { | 1754 | { |
1661 | state_entry() | 1755 | state_entry() |
@@ -1671,17 +1765,22 @@ default | |||
1671 | } | 1765 | } |
1672 | catch (System.Exception e) | 1766 | catch (System.Exception e) |
1673 | { | 1767 | { |
1674 | // The syntax error is on line 6, char 5 (expected ';', found | 1768 | // The syntax error is on line 5, char 4 (expected ';', found |
1675 | // '}'). | 1769 | // '}'). |
1676 | Assert.AreEqual("(4,4) syntax error", e.Message); | 1770 | Assert.AreEqual("(5,4) syntax error", e.Message); |
1677 | throw; | 1771 | gotException = true; |
1678 | } | 1772 | } |
1773 | |||
1774 | Assert.That(gotException, Is.True); | ||
1679 | } | 1775 | } |
1680 | 1776 | ||
1681 | [Test] | 1777 | [Test] |
1682 | [ExpectedException(typeof(System.Exception))] | ||
1683 | public void TestSyntaxErrorDeclaringVariableInForLoop() | 1778 | public void TestSyntaxErrorDeclaringVariableInForLoop() |
1684 | { | 1779 | { |
1780 | TestHelpers.InMethod(); | ||
1781 | |||
1782 | bool gotException = false; | ||
1783 | |||
1685 | string input = @"default | 1784 | string input = @"default |
1686 | { | 1785 | { |
1687 | state_entry() | 1786 | state_entry() |
@@ -1697,11 +1796,13 @@ default | |||
1697 | } | 1796 | } |
1698 | catch (System.Exception e) | 1797 | catch (System.Exception e) |
1699 | { | 1798 | { |
1700 | // The syntax error is on line 5, char 14 (Syntax error) | 1799 | // The syntax error is on line 4, char 13 (Syntax error) |
1701 | Assert.AreEqual("(3,13) syntax error", e.Message); | 1800 | Assert.AreEqual("(4,13) syntax error", e.Message); |
1702 | 1801 | ||
1703 | throw; | 1802 | gotException = true; |
1704 | } | 1803 | } |
1804 | |||
1805 | Assert.That(gotException, Is.True); | ||
1705 | } | 1806 | } |
1706 | } | 1807 | } |
1707 | } | 1808 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs index c5483c8..1fa6954 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using Microsoft.CSharp; | 31 | using Microsoft.CSharp; |
32 | using NUnit.Framework; | 32 | using NUnit.Framework; |
33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 33 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
34 | using OpenSim.Tests.Common; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | 36 | namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests |
36 | { | 37 | { |
@@ -92,6 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
92 | //[Test] | 93 | //[Test] |
93 | public void TestUseUndeclaredVariable() | 94 | public void TestUseUndeclaredVariable() |
94 | { | 95 | { |
96 | TestHelpers.InMethod(); | ||
97 | |||
95 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); | 98 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); |
96 | 99 | ||
97 | string input = @"default | 100 | string input = @"default |
@@ -124,6 +127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests | |||
124 | //[Test] | 127 | //[Test] |
125 | public void TestCastAndConcatString() | 128 | public void TestCastAndConcatString() |
126 | { | 129 | { |
130 | TestHelpers.InMethod(); | ||
131 | |||
127 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); | 132 | m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); |
128 | 133 | ||
129 | string input = @"string s = "" a string""; | 134 | string input = @"string s = "" a string""; |
@@ -150,4 +155,4 @@ default | |||
150 | Assert.AreEqual(0, m_compilerResults.Errors.Count); | 155 | Assert.AreEqual(0, m_compilerResults.Errors.Count); |
151 | } | 156 | } |
152 | } | 157 | } |
153 | } | 158 | } \ No newline at end of file |