mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
Test case for bug 281782.
This commit is contained in:
parent
9827475e98
commit
b2d643fdbf
1 changed files with 51 additions and 14 deletions
|
@ -1577,11 +1577,11 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #undef YYY
|
// #undef BBB
|
||||||
|
|
||||||
// #define YYY
|
// #define BBB
|
||||||
// #include "header.h"
|
// #include "header.h"
|
||||||
// #ifdef YYY
|
// #ifdef BBB
|
||||||
// int bug227088;
|
// int bug227088;
|
||||||
// #else
|
// #else
|
||||||
// int ok;
|
// int ok;
|
||||||
|
@ -1975,17 +1975,54 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
index.releaseReadLock();
|
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
|
// // a.h
|
||||||
// #undef XXX
|
// #undef AAA
|
||||||
|
|
||||||
// // b.h
|
// // b.h
|
||||||
// #include "a.h"
|
// #include "a.h"
|
||||||
// #define XXX
|
// #define AAA
|
||||||
|
|
||||||
// // source.c
|
// // source.c
|
||||||
// #include "b.h"
|
// #include "b.h"
|
||||||
// #ifdef XXX
|
// #ifdef AAA
|
||||||
// int ok;
|
// int ok;
|
||||||
// #endif
|
// #endif
|
||||||
public void testPreprocessingStatementOrder_270806_1() throws Exception {
|
public void testPreprocessingStatementOrder_270806_1() throws Exception {
|
||||||
|
@ -2011,15 +2048,15 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// // a.h
|
// // a.h
|
||||||
// #undef XXX
|
// #undef AAA
|
||||||
|
|
||||||
// // b.h
|
// // b.h
|
||||||
// #define XXX
|
// #define AAA
|
||||||
// #include "a.h"
|
// #include "a.h"
|
||||||
|
|
||||||
// // source.c
|
// // source.c
|
||||||
// #include "b.h"
|
// #include "b.h"
|
||||||
// #ifdef XXX
|
// #ifdef AAA
|
||||||
// int bug;
|
// int bug;
|
||||||
// #endif
|
// #endif
|
||||||
public void testPreprocessingStatementOrder_270806_2() throws Exception {
|
public void testPreprocessingStatementOrder_270806_2() throws Exception {
|
||||||
|
@ -2046,8 +2083,8 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
|
|
||||||
// namespace X {}
|
// namespace X {}
|
||||||
// namespace Y {}
|
// namespace Y {}
|
||||||
// #define XXX
|
// #define AAA
|
||||||
// #define YYY
|
// #define BBB
|
||||||
// #include "inc.h"
|
// #include "inc.h"
|
||||||
// #include <inc.h>
|
// #include <inc.h>
|
||||||
// using namespace X;
|
// using namespace X;
|
||||||
|
@ -2070,8 +2107,8 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
// check order of macros
|
// check order of macros
|
||||||
IIndexMacro[] macros = file.getMacros();
|
IIndexMacro[] macros = file.getMacros();
|
||||||
assertEquals(2, macros.length);
|
assertEquals(2, macros.length);
|
||||||
assertEquals("XXX", macros[0].getName());
|
assertEquals("AAA", macros[0].getName());
|
||||||
assertEquals("YYY", macros[1].getName());
|
assertEquals("BBB", macros[1].getName());
|
||||||
// check order of using directives
|
// check order of using directives
|
||||||
ICPPUsingDirective[] uds = file.getUsingDirectives();
|
ICPPUsingDirective[] uds = file.getUsingDirectives();
|
||||||
assertEquals(2, uds.length);
|
assertEquals(2, uds.length);
|
||||||
|
|
Loading…
Add table
Reference in a new issue