Browse Source

Fixed tests.

newNRvisualizers
Mike Krüger 15 years ago
parent
commit
41168e39b9
  1. 9
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/GotoStatementTests.cs
  2. 4
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/WhileStatementTests.cs

9
ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/GotoStatementTests.cs

@ -13,23 +13,20 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
[Test, Ignore("regular goto statement is broken")] [Test, Ignore("regular goto statement is broken")]
public void GotoStatementTest() public void GotoStatementTest()
{ {
GotoStatement gotoStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto myLabel;"); var gotoStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto myLabel;");
Assert.AreEqual(GotoType.Label, gotoStmt.GotoType);
Assert.AreEqual("myLabel", gotoStmt.Label); Assert.AreEqual("myLabel", gotoStmt.Label);
} }
[Test] [Test]
public void GotoDefaultStatementTest() public void GotoDefaultStatementTest()
{ {
GotoStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto default;"); var gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoDefaultStatement>("goto default;");
Assert.AreEqual(GotoType.CaseDefault, gotoCaseStmt.GotoType);
} }
[Test] [Test]
public void GotoCaseStatementTest() public void GotoCaseStatementTest()
{ {
GotoStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto case 6;"); var gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoCaseStatement>("goto case 6;");
Assert.AreEqual(GotoType.Case, gotoCaseStmt.GotoType);
Assert.IsTrue(gotoCaseStmt.LabelExpression is PrimitiveExpression); Assert.IsTrue(gotoCaseStmt.LabelExpression is PrimitiveExpression);
} }

4
ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/WhileStatementTests.cs

@ -13,7 +13,6 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
public void WhileStatementTest() public void WhileStatementTest()
{ {
WhileStatement loopStmt = ParseUtilCSharp.ParseStatement<WhileStatement>("while (true) { }"); WhileStatement loopStmt = ParseUtilCSharp.ParseStatement<WhileStatement>("while (true) { }");
Assert.AreEqual(WhilePosition.Begin, loopStmt.WhilePosition);
Assert.IsTrue(loopStmt.Condition is PrimitiveExpression); Assert.IsTrue(loopStmt.Condition is PrimitiveExpression);
Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement); Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement);
} }
@ -21,8 +20,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
[Test] [Test]
public void DoWhileStatementTest() public void DoWhileStatementTest()
{ {
WhileStatement loopStmt = ParseUtilCSharp.ParseStatement<WhileStatement>("do { } while (true);"); DoWhileStatement loopStmt = ParseUtilCSharp.ParseStatement<DoWhileStatement>("do { } while (true);");
Assert.AreEqual(WhilePosition.End, loopStmt.WhilePosition);
Assert.IsTrue(loopStmt.Condition is PrimitiveExpression); Assert.IsTrue(loopStmt.Condition is PrimitiveExpression);
Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement); Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement);
} }

Loading…
Cancel
Save