3rdparty/NRefactory/ICSharpCode.NRefactory.Tests/CSharp/Parser/Bugs/ParserBugTests.cs
/// <summary>
/// Bug 3517 - Incomplete conditional operator in the AST request.
/// </summary>
Bug 3517 - Incomplete conditional operator in the AST request.
Bug 3517 - Incomplete conditional operator in the AST request .
[Test]
		public void TestBug3517()
		{
			string code = 
@"class Test
{
	void Foo ()
	{
		a = cond ? expr
	}
}";
			var unit = SyntaxTree.Parse(code);
			var type = unit.Members.First() as TypeDeclaration;
			var method = type.Members.First() as MethodDeclaration;
			var exprStmt = method.Body.Statements.FirstOrDefault() as ExpressionStatement;
			var expr = exprStmt.Expression as AssignmentExpression;
			bool passed = expr != null && expr.Right is ConditionalExpression;
			if (!passed) {
				Console.WriteLine("Expected:" + code);
				Console.WriteLine("Was:" + unit);
			}
			Assert.IsTrue(passed);
		}
[ Test ] public void TestBug3517 ( ) { string code = @"class Test
{
	void Foo ()
	{
		a = cond ? expr
	}
}" ; var unit = SyntaxTree . Parse ( code ) ; var type = unit . Members . First ( ) as TypeDeclaration ; var method = type . Members . First ( ) as MethodDeclaration ; var exprStmt = method . Body . Statements . FirstOrDefault ( ) as ExpressionStatement ; var expr = exprStmt . Expression as AssignmentExpression ; bool passed = expr != null && expr . Right is ConditionalExpression ; if ( ! passed ) { Console . WriteLine ( " " + code ) ; Console . WriteLine ( " " + unit ) ; } Assert . IsTrue ( passed ) ; }
Bug 3517 - Incomplete conditional operator in the AST request.
Bug 3517 - Incomplete conditional operator in the AST request .