diff options
author | Justin Clark-Casey (justincc) | 2012-03-06 02:30:22 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-06 02:30:22 +0000 |
commit | b3449e998ab7fc9a952559821caea6484fc57e6e (patch) | |
tree | efe0d8e9bc09b8da71bd7eea994f24c4b108ccf4 /OpenSim/Region/ScriptEngine/Shared | |
parent | Get all test methods in OpenSim.Region.ScriptEngine.Tests.dll to report that ... (diff) | |
download | opensim-SC-b3449e998ab7fc9a952559821caea6484fc57e6e.zip opensim-SC-b3449e998ab7fc9a952559821caea6484fc57e6e.tar.gz opensim-SC-b3449e998ab7fc9a952559821caea6484fc57e6e.tar.bz2 opensim-SC-b3449e998ab7fc9a952559821caea6484fc57e6e.tar.xz |
Fix TestSyntaxError() and TestSyntaxErrorDeclaringVariableInForLoop()
They were all failing assertions but the exceptions these threw were caught as expected Exceptions.
I don't think we can easily distinguish these from the Exceptions that we're expecting.
So for now we'll do some messy manually checking with boolean setting instead.
This patch also corrects the assertions themselves.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs index 2add011..7763619 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs | |||
@@ -1744,11 +1744,12 @@ default | |||
1744 | } | 1744 | } |
1745 | 1745 | ||
1746 | [Test] | 1746 | [Test] |
1747 | [ExpectedException(typeof(System.Exception))] | ||
1748 | public void TestSyntaxError() | 1747 | public void TestSyntaxError() |
1749 | { | 1748 | { |
1750 | TestHelpers.InMethod(); | 1749 | TestHelpers.InMethod(); |
1751 | 1750 | ||
1751 | bool gotException = false; | ||
1752 | |||
1752 | string input = @"default | 1753 | string input = @"default |
1753 | { | 1754 | { |
1754 | state_entry() | 1755 | state_entry() |
@@ -1764,19 +1765,22 @@ default | |||
1764 | } | 1765 | } |
1765 | catch (System.Exception e) | 1766 | catch (System.Exception e) |
1766 | { | 1767 | { |
1767 | // The syntax error is on line 6, char 5 (expected ';', found | 1768 | // The syntax error is on line 5, char 4 (expected ';', found |
1768 | // '}'). | 1769 | // '}'). |
1769 | Assert.AreEqual("(4,4) syntax error", e.Message); | 1770 | Assert.AreEqual("(5,4) syntax error", e.Message); |
1770 | throw; | 1771 | gotException = true; |
1771 | } | 1772 | } |
1773 | |||
1774 | Assert.That(gotException, Is.True); | ||
1772 | } | 1775 | } |
1773 | 1776 | ||
1774 | [Test] | 1777 | [Test] |
1775 | [ExpectedException(typeof(System.Exception))] | ||
1776 | public void TestSyntaxErrorDeclaringVariableInForLoop() | 1778 | public void TestSyntaxErrorDeclaringVariableInForLoop() |
1777 | { | 1779 | { |
1778 | TestHelpers.InMethod(); | 1780 | TestHelpers.InMethod(); |
1779 | 1781 | ||
1782 | bool gotException = false; | ||
1783 | |||
1780 | string input = @"default | 1784 | string input = @"default |
1781 | { | 1785 | { |
1782 | state_entry() | 1786 | state_entry() |
@@ -1792,11 +1796,13 @@ default | |||
1792 | } | 1796 | } |
1793 | catch (System.Exception e) | 1797 | catch (System.Exception e) |
1794 | { | 1798 | { |
1795 | // The syntax error is on line 5, char 14 (Syntax error) | 1799 | // The syntax error is on line 4, char 13 (Syntax error) |
1796 | Assert.AreEqual("(3,13) syntax error", e.Message); | 1800 | Assert.AreEqual("(4,13) syntax error", e.Message); |
1797 | 1801 | ||
1798 | throw; | 1802 | gotException = true; |
1799 | } | 1803 | } |
1804 | |||
1805 | Assert.That(gotException, Is.True); | ||
1800 | } | 1806 | } |
1801 | } | 1807 | } |
1802 | } | 1808 | } |