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.0.7.4.1
parent
a92153ed88
commit
b3449e998a
|
@ -1744,11 +1744,12 @@ default
|
|||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(System.Exception))]
|
||||
public void TestSyntaxError()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool gotException = false;
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1764,19 +1765,22 @@ default
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
// The syntax error is on line 6, char 5 (expected ';', found
|
||||
// The syntax error is on line 5, char 4 (expected ';', found
|
||||
// '}').
|
||||
Assert.AreEqual("(4,4) syntax error", e.Message);
|
||||
throw;
|
||||
Assert.AreEqual("(5,4) syntax error", e.Message);
|
||||
gotException = true;
|
||||
}
|
||||
|
||||
Assert.That(gotException, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(System.Exception))]
|
||||
public void TestSyntaxErrorDeclaringVariableInForLoop()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
bool gotException = false;
|
||||
|
||||
string input = @"default
|
||||
{
|
||||
state_entry()
|
||||
|
@ -1792,11 +1796,13 @@ default
|
|||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
// The syntax error is on line 5, char 14 (Syntax error)
|
||||
Assert.AreEqual("(3,13) syntax error", e.Message);
|
||||
// The syntax error is on line 4, char 13 (Syntax error)
|
||||
Assert.AreEqual("(4,13) syntax error", e.Message);
|
||||
|
||||
throw;
|
||||
gotException = true;
|
||||
}
|
||||
|
||||
Assert.That(gotException, Is.True);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue