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 @@ -13,23 +13,20 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
[Test, Ignore("regular goto statement is broken")]
public void GotoStatementTest()
{
GotoStatement gotoStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto myLabel;");
Assert.AreEqual(GotoType.Label, gotoStmt.GotoType);
var gotoStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto myLabel;");
Assert.AreEqual("myLabel", gotoStmt.Label);
}
[Test]
public void GotoDefaultStatementTest()
{
GotoStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto default;");
Assert.AreEqual(GotoType.CaseDefault, gotoCaseStmt.GotoType);
var gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoDefaultStatement>("goto default;");
}
[Test]
public void GotoCaseStatementTest()
{
GotoStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto case 6;");
Assert.AreEqual(GotoType.Case, gotoCaseStmt.GotoType);
var gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoCaseStatement>("goto case 6;");
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 @@ -13,7 +13,6 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
public void WhileStatementTest()
{
WhileStatement loopStmt = ParseUtilCSharp.ParseStatement<WhileStatement>("while (true) { }");
Assert.AreEqual(WhilePosition.Begin, loopStmt.WhilePosition);
Assert.IsTrue(loopStmt.Condition is PrimitiveExpression);
Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement);
}
@ -21,8 +20,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements @@ -21,8 +20,7 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
[Test]
public void DoWhileStatementTest()
{
WhileStatement loopStmt = ParseUtilCSharp.ParseStatement<WhileStatement>("do { } while (true);");
Assert.AreEqual(WhilePosition.End, loopStmt.WhilePosition);
DoWhileStatement loopStmt = ParseUtilCSharp.ParseStatement<DoWhileStatement>("do { } while (true);");
Assert.IsTrue(loopStmt.Condition is PrimitiveExpression);
Assert.IsTrue(loopStmt.EmbeddedStatement is BlockStatement);
}

Loading…
Cancel
Save