aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests
diff options
context:
space:
mode:
authorMike Mazur2009-06-07 10:22:41 +0000
committerMike Mazur2009-06-07 10:22:41 +0000
commit48bc2f3a4299390538efeb1c0bd97424cfa1ea28 (patch)
treeecf607b4a1dd80530faa3de69708bc1d7a4ce76a /OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests
parent* Reverting the test restructuring as, on second thought, this is not at all ... (diff)
downloadopensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.zip
opensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.gz
opensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.bz2
opensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.xz
Allow empty assignment in for-loop
For loops with no assignment are no longer syntax errors. For example, this is now valid: for ( ; i < 10; i++) { ... } Corresponding changes to lsl.{lexer,parser} in r99 in opensim-libs. Fixes Mantis #2501. Fixes Mantis #2884.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
index c482422..a7d4fa9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
@@ -1516,6 +1516,31 @@ default
1516 } 1516 }
1517 1517
1518 [Test] 1518 [Test]
1519 public void TestForLoopWithNoAssignment()
1520 {
1521 string input = @"default
1522{
1523 state_entry()
1524 {
1525 integer x = 4;
1526 for (; 1<0; x += 2);
1527 }
1528}";
1529
1530 string expected =
1531 "\n public void default_event_state_entry()" +
1532 "\n {" +
1533 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(4);" +
1534 "\n for (; new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0); x += new LSL_Types.LSLInteger(2))" +
1535 "\n ;" +
1536 "\n }\n";
1537
1538 CSCodeGenerator cg = new CSCodeGenerator();
1539 string output = cg.Convert(input);
1540 Assert.AreEqual(expected, output);
1541 }
1542
1543 [Test]
1519 public void TestAssignmentInIfWhileDoWhile() 1544 public void TestAssignmentInIfWhileDoWhile()
1520 { 1545 {
1521 string input = @"default 1546 string input = @"default