From 7484954d7f9f41129241cb4910b0e929455f58e6 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Mon, 3 Mar 2008 13:51:04 +0000 Subject: [PATCH] Testcase for navigation on empty macro, bug 198649. --- .../selection/CPPSelectionTestsNoIndexer.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java index 54614ad3eb5..21e216af613 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/selection/CPPSelectionTestsNoIndexer.java @@ -1012,4 +1012,21 @@ public class CPPSelectionTestsNoIndexer extends BaseUITestCase { assertEquals(((ASTNode)decl).getOffset(), code.length() + od2); } } + + // #define EMPTY + // EMPTY void foo() {} + public void testEmptyMacro_Bug198649() throws Exception { + String code= getContentsForTest(1)[0].toString(); + String[] filenames= {"testBug198649.c", "testBug198649.cpp"}; + for (int i=0; i<2; i++) { + IFile file = importFile(filenames[i], code); + int od1 = code.indexOf("EMPTY"); + int or1 = code.indexOf("EMPTY", od1+1); + + IASTNode decl = testF3(file, or1); + assertTrue(decl instanceof IASTName); + assertEquals(((IASTName)decl).toString(), "EMPTY"); //$NON-NLS-1$ + assertEquals(((ASTNode)decl).getOffset(), od1); + } + } }