Browse Source

Merge pull request #125 from erik-kallen/bug-comment-before-try-catch-finally

Bug with comment just before try/catch/finally statement.
newNRvisualizers
Mike Krüger 13 years ago
parent
commit
f24ac256e1
  1. 18
      ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/TryCatchStatementTests.cs

18
ICSharpCode.NRefactory.Tests/CSharp/Parser/Statements/TryCatchStatementTests.cs

@ -85,5 +85,23 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements @@ -85,5 +85,23 @@ namespace ICSharpCode.NRefactory.CSharp.Parser.Statements
Assert.IsFalse(c1.IsMatch(c2));
Assert.IsFalse(c2.IsMatch(c1)); // and vice versa
}
[Test]
public void CommentBeforeTryCatchFinally()
{
var stmt = ParseUtilCSharp.ParseStatement<BlockStatement>(
@"{
//Comment before
try { } catch { } finally { }
//Comment after
}");
var children = stmt.Children.ToList();
Assert.That(children.Count, Is.EqualTo(5));
Assert.That(children[0].Role, Is.EqualTo(Roles.LBrace));
Assert.That(children[1].Role, Is.EqualTo(Roles.Comment));
Assert.That(children[2].Role, Is.EqualTo(BlockStatement.StatementRole));
Assert.That(children[3].Role, Is.EqualTo(Roles.Comment));
Assert.That(children[4].Role, Is.EqualTo(Roles.RBrace));
}
}
}

Loading…
Cancel
Save