3rdparty/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs
/// <summary>
/// Bug 4059 - Return statement without semicolon missing in the AST
/// </summary>
Bug 4059 - Return statement without semicolon missing in the AST
Bug 4059 - Return statement without semicolon missing in the AST
[Test]
		public void TestBug4059()
		{
			string code = @"
class Stub
{
    Test A ()
    {
        return new Test ()
    }
}";
			var unit = SyntaxTree.Parse(code);
			var type = unit.Members.First() as TypeDeclaration;
			var method = type.Members.First() as MethodDeclaration;
			bool passed = method.Body.Statements.FirstOrDefault() is ReturnStatement;
			if (!passed) {
				Console.WriteLine("Expected:" + code);
				Console.WriteLine("Was:" + unit);
			}
			Assert.IsTrue(passed);
		}
[ Test ] public void TestBug4059 ( ) { string code = @"
class Stub
{
    Test A ()
    {
        return new Test ()
    }
}" ; var unit = SyntaxTree . Parse ( code ) ; var type = unit . Members . First ( ) as TypeDeclaration ; var method = type . Members . First ( ) as MethodDeclaration ; bool passed = method . Body . Statements . FirstOrDefault ( ) is ReturnStatement ; if ( ! passed ) { Console . WriteLine ( " " + code ) ; Console . WriteLine ( " " + unit ) ; } Assert . IsTrue ( passed ) ; }
Bug 4059 - Return statement without semicolon missing in the AST
Bug 4059 - Return statement without semicolon missing in the AST