diff options
author | Sergey Prigogin | 2009-06-28 18:47:14 +0000 |
---|---|---|
committer | Sergey Prigogin | 2009-06-28 18:47:14 +0000 |
commit | b7c2d5257c4624dc0eac3bd94a6cf2c275ec7345 (patch) | |
tree | 7e64ee35935b598e9e7212d781373d790795b1f1 /core/org.eclipse.cdt.core.tests | |
parent | 71543e44b06d30aca75623238a5ad4be41340a73 (diff) | |
download | org.eclipse.cdt-b7c2d5257c4624dc0eac3bd94a6cf2c275ec7345.tar.gz org.eclipse.cdt-b7c2d5257c4624dc0eac3bd94a6cf2c275ec7345.tar.xz org.eclipse.cdt-b7c2d5257c4624dc0eac3bd94a6cf2c275ec7345.zip |
Test case for bug 281782.
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r-- | core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBugsTests.java | 65 |
1 files changed, 51 insertions, 14 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 8f2a8fe3785..fbb5b8a8214 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 @@ -1577,11 +1577,11 @@ public class IndexBugsTests extends BaseTestCase { } } - // #undef YYY + // #undef BBB - // #define YYY + // #define BBB // #include "header.h" - // #ifdef YYY + // #ifdef BBB // int bug227088; // #else // int ok; @@ -1975,17 +1975,54 @@ public class IndexBugsTests extends BaseTestCase { index.releaseReadLock(); } } - + + // // header.h + // template<class T> + // struct A { + // void m(const T& p); + // }; + + // #include "header.h" + // namespace { + // enum E { e1 }; + // } + // + // void test() { + // A<E> a; + // a.m(e1); + // } + + // enum E { e2 }; + public void _testDisambiguationByReachability_281782() throws Exception { + waitForIndexer(); + + String[] testData = getContentsForTest(3); + TestSourceReader.createFile(fCProject.getProject(), "header.h", testData[0]); + IFile test= TestSourceReader.createFile(fCProject.getProject(), "test.cpp", testData[1]); + TestSourceReader.createFile(fCProject.getProject(), "unrelated.cpp", testData[2]); + final IIndexManager indexManager = CCorePlugin.getIndexManager(); + indexManager.reindex(fCProject); + waitForIndexer(); + IIndex index= indexManager.getIndex(fCProject); + index.acquireReadLock(); + try { + IASTTranslationUnit ast = TestSourceReader.createIndexBasedAST(index, fCProject, test); + getBindingFromASTName(ast, testData[1], "m(e1)", 1, ICPPMethod.class); + } finally { + index.releaseReadLock(); + } + } + // // a.h - // #undef XXX + // #undef AAA // // b.h // #include "a.h" - // #define XXX + // #define AAA // // source.c // #include "b.h" - // #ifdef XXX + // #ifdef AAA // int ok; // #endif public void testPreprocessingStatementOrder_270806_1() throws Exception { @@ -2011,15 +2048,15 @@ public class IndexBugsTests extends BaseTestCase { } // // a.h - // #undef XXX + // #undef AAA // // b.h - // #define XXX + // #define AAA // #include "a.h" // // source.c // #include "b.h" - // #ifdef XXX + // #ifdef AAA // int bug; // #endif public void testPreprocessingStatementOrder_270806_2() throws Exception { @@ -2046,8 +2083,8 @@ public class IndexBugsTests extends BaseTestCase { // namespace X {} // namespace Y {} - // #define XXX - // #define YYY + // #define AAA + // #define BBB // #include "inc.h" // #include <inc.h> // using namespace X; @@ -2070,8 +2107,8 @@ public class IndexBugsTests extends BaseTestCase { // check order of macros IIndexMacro[] macros = file.getMacros(); assertEquals(2, macros.length); - assertEquals("XXX", macros[0].getName()); - assertEquals("YYY", macros[1].getName()); + assertEquals("AAA", macros[0].getName()); + assertEquals("BBB", macros[1].getName()); // check order of using directives ICPPUsingDirective[] uds = file.getUsingDirectives(); assertEquals(2, uds.length); |