From 259c26f4520ee7d93cbb5870d76ca49015230e70 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Fri, 30 May 2008 13:56:12 +0000 Subject: [PATCH] testcase for bug 84276 --- .../cdt/core/parser/tests/ast2/AST2Tests.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 19e496add9f..bd0cffd07da 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -4795,4 +4795,19 @@ public class AST2Tests extends AST2BaseTest { assertEquals(IBasicType.t_void, ((IBasicType)pt).getType()); } } + + // #define str(s) # s + // + // void foo() { + // printf(str(this is a // this should go away + // string)); + // } + public void testCommentInExpansion_Bug84276() throws Exception { + IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment()); + IASTFunctionDefinition func= (IASTFunctionDefinition) tu.getDeclarations()[0]; + + IASTFunctionCallExpression fcall= (IASTFunctionCallExpression) ((IASTExpressionStatement)((IASTCompoundStatement) func.getBody()).getStatements()[0]).getExpression(); + IASTLiteralExpression lit= (IASTLiteralExpression) fcall.getParameterExpression(); + assertEquals("\"this is a string\"", lit.toString()); + } }