1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

2005-08-30 Alain Magloire

New test for PR 109202 (written by Devin Steffler)
	* ui/org/eclipse/cdt/ui/tests/tex/selectiontests/CPPSelectionTestsDOMIndexer.java
This commit is contained in:
Alain Magloire 2005-08-30 20:17:22 +00:00
parent 1abe3efac6
commit 0972235514
2 changed files with 28 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2005-08-30 Alain Magloire
New test for PR 109202 (written by Devin Steffler)
* ui/org/eclipse/cdt/ui/tests/tex/selectiontests/CPPSelectionTestsDOMIndexer.java
2005-06-08 Alain Magloire 2005-06-08 Alain Magloire
Move to the IContentTypeManager framework: PR 86645 Move to the IContentTypeManager framework: PR 86645
* src.org.eclipse/cdt/ui/tests/DOMAST/DOMAST.java * src.org.eclipse/cdt/ui/tests/DOMAST/DOMAST.java

View file

@ -130,6 +130,7 @@ public class CPPSelectionTestsDOMIndexer extends BaseSelectionTestsIndexer imple
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug103323")); //$NON-NLS-1$ suite.addTest(new CPPSelectionTestsDOMIndexer("testBug103323")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug103697")); //$NON-NLS-1$ suite.addTest(new CPPSelectionTestsDOMIndexer("testBug103697")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug76043")); //$NON-NLS-1$ suite.addTest(new CPPSelectionTestsDOMIndexer("testBug76043")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug108202")); //$NON-NLS-1$
return suite; return suite;
} }
@ -1142,5 +1143,28 @@ public class CPPSelectionTestsDOMIndexer extends BaseSelectionTestsIndexer imple
assertEquals(((ASTNode)decl).getLength(), 1); assertEquals(((ASTNode)decl).getLength(), 1);
} }
public void testBug108202() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("class __attribute__((visibility(\"default\"))) FooClass\n"); //$NON-NLS-1$
buffer.append("{\n"); //$NON-NLS-1$
buffer.append("int foo();\n"); //$NON-NLS-1$
buffer.append("};\n"); //$NON-NLS-1$
buffer.append("int FooClass::foo() {\n"); //$NON-NLS-1$
buffer.append("return 0;\n"); //$NON-NLS-1$
buffer.append("}\n"); //$NON-NLS-1$
String code = buffer.toString();
IFile file = importFile("testBug108202.cpp", code); //$NON-NLS-1$
int offset = code.indexOf("foo();\n"); //$NON-NLS-1$
IASTNode def = testCtrl_F3(file, offset);
IASTNode decl = testF3(file, offset);
assertTrue(def instanceof IASTName);
assertEquals(((IASTName)def).toString(), "foo"); //$NON-NLS-1$
assertEquals(((ASTNode)def).getOffset(), 84);
assertEquals(((ASTNode)def).getLength(), 3);
}
// REMINDER: see CPPSelectionTestsDomIndexer#suite() when appending new tests to this suite // REMINDER: see CPPSelectionTestsDomIndexer#suite() when appending new tests to this suite
} }