aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs125
1 files changed, 125 insertions, 0 deletions
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
index 9547b0b..6e4d029 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
@@ -1395,6 +1395,131 @@ default
1395 } 1395 }
1396 1396
1397 [Test] 1397 [Test]
1398 public void TestWhileLoopWithNoBody()
1399 {
1400 string input = @"default
1401{
1402 state_entry()
1403 {
1404 while(1<0);
1405 }
1406}";
1407
1408 string expected = @"
1409 public void default_event_state_entry()
1410 {
1411 while (1 < 0)
1412 ;
1413 }
1414";
1415
1416 CSCodeGenerator cg = new CSCodeGenerator();
1417 string output = cg.Convert(input);
1418 Assert.AreEqual(expected, output);
1419 }
1420
1421 [Test]
1422 public void TestDoWhileLoopWithNoBody()
1423 {
1424 string input = @"default
1425{
1426 state_entry()
1427 {
1428 do;
1429 while(1<0);
1430 }
1431}";
1432
1433 string expected = @"
1434 public void default_event_state_entry()
1435 {
1436 do
1437 ;
1438 while (1 < 0);
1439 }
1440";
1441
1442 CSCodeGenerator cg = new CSCodeGenerator();
1443 string output = cg.Convert(input);
1444 Assert.AreEqual(expected, output);
1445 }
1446
1447 [Test]
1448 public void TestIfWithNoBody()
1449 {
1450 string input = @"default
1451{
1452 state_entry()
1453 {
1454 if(1<0);
1455 }
1456}";
1457
1458 string expected = @"
1459 public void default_event_state_entry()
1460 {
1461 if (1 < 0)
1462 ;
1463 }
1464";
1465
1466 CSCodeGenerator cg = new CSCodeGenerator();
1467 string output = cg.Convert(input);
1468 Assert.AreEqual(expected, output);
1469 }
1470
1471 [Test]
1472 public void TestIfElseWithNoBody()
1473 {
1474 string input = @"default
1475{
1476 state_entry()
1477 {
1478 if(1<0);
1479 else;
1480 }
1481}";
1482
1483 string expected = @"
1484 public void default_event_state_entry()
1485 {
1486 if (1 < 0)
1487 ;
1488 else
1489 ;
1490 }
1491";
1492
1493 CSCodeGenerator cg = new CSCodeGenerator();
1494 string output = cg.Convert(input);
1495 Assert.AreEqual(expected, output);
1496 }
1497
1498 [Test]
1499 public void TestForLoopWithNoBody()
1500 {
1501 string input = @"default
1502{
1503 state_entry()
1504 {
1505 for(x = 4; 1<0; x += 2);
1506 }
1507}";
1508
1509 string expected = @"
1510 public void default_event_state_entry()
1511 {
1512 for (x = 4; 1 < 0; x += 2)
1513 ;
1514 }
1515";
1516
1517 CSCodeGenerator cg = new CSCodeGenerator();
1518 string output = cg.Convert(input);
1519 Assert.AreEqual(expected, output);
1520 }
1521
1522 [Test]
1398 [ExpectedException("Tools.CSToolsException")] 1523 [ExpectedException("Tools.CSToolsException")]
1399 public void TestSyntaxError() 1524 public void TestSyntaxError()
1400 { 1525 {