diff options
author | Melanie Thielker | 2008-09-27 05:58:52 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-27 05:58:52 +0000 |
commit | 1f8888a287f6867a71e997363787a6979b70e2db (patch) | |
tree | 302efa90f22434d6e66259f37d2258c573ff77db /OpenSim/Region | |
parent | Add friendly error messages to both engines. (diff) | |
download | opensim-SC_OLD-1f8888a287f6867a71e997363787a6979b70e2db.zip opensim-SC_OLD-1f8888a287f6867a71e997363787a6979b70e2db.tar.gz opensim-SC_OLD-1f8888a287f6867a71e997363787a6979b70e2db.tar.bz2 opensim-SC_OLD-1f8888a287f6867a71e997363787a6979b70e2db.tar.xz |
Update unit tests
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 4e2766c..356f547 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | |||
@@ -1544,7 +1544,7 @@ default | |||
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | [Test] | 1546 | [Test] |
1547 | [ExpectedException(typeof(Tools.CSToolsException))] | 1547 | [ExpectedException(typeof(System.Exception))] |
1548 | public void TestSyntaxError() | 1548 | public void TestSyntaxError() |
1549 | { | 1549 | { |
1550 | string input = @"default | 1550 | string input = @"default |
@@ -1560,21 +1560,17 @@ default | |||
1560 | CSCodeGenerator cg = new CSCodeGenerator(); | 1560 | CSCodeGenerator cg = new CSCodeGenerator(); |
1561 | cg.Convert(input); | 1561 | cg.Convert(input); |
1562 | } | 1562 | } |
1563 | catch (Tools.CSToolsException e) | 1563 | catch (System.Exception e) |
1564 | { | 1564 | { |
1565 | // The syntax error is on line 6, char 5 (expected ';', found | 1565 | // The syntax error is on line 6, char 5 (expected ';', found |
1566 | // '}'). | 1566 | // '}'). |
1567 | Regex r = new Regex("Line ([0-9]+), char ([0-9]+)"); | 1567 | Assert.AreEqual("Line (5,4) Line 6, char 5: syntax error", e.Message); |
1568 | Match m = r.Match(e.Message); | ||
1569 | Assert.AreEqual("6", m.Groups[1].Value); | ||
1570 | Assert.AreEqual("5", m.Groups[2].Value); | ||
1571 | |||
1572 | throw; | 1568 | throw; |
1573 | } | 1569 | } |
1574 | } | 1570 | } |
1575 | 1571 | ||
1576 | [Test] | 1572 | [Test] |
1577 | [ExpectedException(typeof(Tools.CSToolsException))] | 1573 | [ExpectedException(typeof(System.Exception))] |
1578 | public void TestSyntaxErrorDeclaringVariableInForLoop() | 1574 | public void TestSyntaxErrorDeclaringVariableInForLoop() |
1579 | { | 1575 | { |
1580 | string input = @"default | 1576 | string input = @"default |
@@ -1590,13 +1586,10 @@ default | |||
1590 | CSCodeGenerator cg = new CSCodeGenerator(); | 1586 | CSCodeGenerator cg = new CSCodeGenerator(); |
1591 | cg.Convert(input); | 1587 | cg.Convert(input); |
1592 | } | 1588 | } |
1593 | catch (Tools.CSToolsException e) | 1589 | catch (System.Exception e) |
1594 | { | 1590 | { |
1595 | // The syntax error is on line 5, char 14 (Syntax error) | 1591 | // The syntax error is on line 5, char 14 (Syntax error) |
1596 | Regex r = new Regex("Line ([0-9]+), char ([0-9]+)"); | 1592 | Assert.AreEqual("Line (4,13) Line 5, char 14: syntax error", e.Message); |
1597 | Match m = r.Match(e.Message); | ||
1598 | Assert.AreEqual("5", m.Groups[1].Value); | ||
1599 | Assert.AreEqual("14", m.Groups[2].Value); | ||
1600 | 1593 | ||
1601 | throw; | 1594 | throw; |
1602 | } | 1595 | } |