Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2007-05-09 11:54:51 +0000
committerAndrew Ferguson2007-05-09 11:54:51 +0000
commit6c161d4b548c9ad2fd2784dd0c127504503f4576 (patch)
treee0eb65cf64809d895cc726a2b14e513cc9bac047
parentd5aad42f7056c96c2b00a4358210d1a7fcfb3f51 (diff)
downloadorg.eclipse.cdt-6c161d4b548c9ad2fd2784dd0c127504503f4576.tar.gz
org.eclipse.cdt-6c161d4b548c9ad2fd2784dd0c127504503f4576.tar.xz
org.eclipse.cdt-6c161d4b548c9ad2fd2784dd0c127504503f4576.zip
173997: add a related test case
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java
index 7a34db5fcff..6f50ac9a34d 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java
@@ -117,6 +117,47 @@ public class IndexBugsTests extends BaseTestCase {
TestSourceReader.waitUntilFileIsIndexed(fIndex, file, time);
}
+ // class A {};
+ // class B {};
+ // A var;
+
+ // class A {};
+ // class B {};
+ // B var;
+ public void _test173997_2() throws Exception {
+ StringBuffer[] content= getContentsForTest(3);
+
+ IFile file= createFile(getProject(), "header.h", content[0].toString());
+ waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
+
+ IIndex index= CCorePlugin.getIndexManager().getIndex(fCProject);
+ index.acquireReadLock();
+ try {
+ IBinding[] bs= index.findBindings("var".toCharArray(), IndexFilter.ALL, NPM);
+ assertEquals(1, bs.length);
+ assertTrue(bs[0] instanceof ICPPVariable);
+ assertTrue(((ICPPVariable)bs[0]).getType() instanceof ICPPClassType);
+ assertEquals("A", ((ICPPClassType)(((ICPPVariable)bs[0]).getType())).getName());
+ } finally {
+ index.releaseReadLock();
+ }
+
+ file.setContents(new ByteArrayInputStream(content[1].toString().getBytes()), true, false, NPM);
+ waitUntilFileIsIndexed(file, INDEX_WAIT_TIME);
+
+ index= CCorePlugin.getIndexManager().getIndex(fCProject);
+ index.acquireReadLock();
+ try {
+ IBinding[] bs= index.findBindings("var".toCharArray(), IndexFilter.ALL, NPM);
+ assertEquals(1, bs.length);
+ assertTrue(bs[0] instanceof ICPPVariable);
+ assertTrue(((ICPPVariable)bs[0]).getType() instanceof ICPPClassType);
+ assertEquals("B", ((ICPPClassType)(((ICPPVariable)bs[0]).getType())).getName());
+ } finally {
+ index.releaseReadLock();
+ }
+ }
+
// namespace ns162011 {
// class Class162011 {
// friend void function162011(Class162011);

Back to the top