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/LSLCompilerTest.cs60
1 files changed, 59 insertions, 1 deletions
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs
index 56a5b4c..3413d0d 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs
@@ -1302,6 +1302,64 @@ default
1302 } 1302 }
1303 1303
1304 [Test] 1304 [Test]
1305 public void TestMultipleEqualsExpression()
1306 {
1307 string input = @"// let's test x = y = 5 type expressions
1308
1309default
1310{
1311 touch_start(integer num_detected)
1312 {
1313 integer x;
1314 integer y;
1315 x = y = 5;
1316 x += y -= 5;
1317 llOwnerSay(""x is: "" + (string) x + "", y is: "" + (string) y);
1318 }
1319}
1320";
1321 string expected = @"
1322 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
1323 {
1324 LSL_Types.LSLInteger x = 0;
1325 LSL_Types.LSLInteger y = 0;
1326 x = y = 5;
1327 x += y -= 5;
1328 llOwnerSay(""x is: "" + (LSL_Types.LSLString) (x) + "", y is: "" + (LSL_Types.LSLString) (y));
1329 }
1330";
1331
1332 CSCodeGenerator cg = new CSCodeGenerator(input);
1333 string output = cg.Generate();
1334 Assert.AreEqual(expected, output);
1335 }
1336
1337 [Test]
1338 public void TestUnaryExpressionLastInVectorConstant()
1339 {
1340 string input = @"// let's test unary expressions some more
1341
1342default
1343{
1344 state_entry()
1345 {
1346 vector v = <x,y,-0.5>;
1347 }
1348}
1349";
1350 string expected = @"
1351 public void default_event_state_entry()
1352 {
1353 LSL_Types.Vector3 v = new LSL_Types.Vector3(x, y, -0.5);
1354 }
1355";
1356
1357 CSCodeGenerator cg = new CSCodeGenerator(input);
1358 string output = cg.Generate();
1359 Assert.AreEqual(expected, output);
1360 }
1361
1362 [Test]
1305 [ExpectedException("Tools.CSToolsException")] 1363 [ExpectedException("Tools.CSToolsException")]
1306 public void TestSyntaxError() 1364 public void TestSyntaxError()
1307 { 1365 {
@@ -1316,7 +1374,7 @@ default
1316 try 1374 try
1317 { 1375 {
1318 CSCodeGenerator cg = new CSCodeGenerator(input); 1376 CSCodeGenerator cg = new CSCodeGenerator(input);
1319 string output = cg.Generate(); 1377 cg.Generate();
1320 } 1378 }
1321 catch (Tools.CSToolsException e) 1379 catch (Tools.CSToolsException e)
1322 { 1380 {