mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Testcase for endless loop following using-directives, bug 209813.
This commit is contained in:
parent
2aa55cf930
commit
950b1db4f2
2 changed files with 15 additions and 1 deletions
|
@ -79,6 +79,7 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
return suite(IndexBugsTests.class);
|
return suite(IndexBugsTests.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
fCProject= CProjectHelper.createCCProject("__bugsTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
fCProject= CProjectHelper.createCCProject("__bugsTest__", "bin", IPDOMManager.ID_FAST_INDEXER);
|
||||||
|
@ -86,6 +87,7 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
fIndex= CCorePlugin.getIndexManager().getIndex(fCProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
if (fCProject != null) {
|
if (fCProject != null) {
|
||||||
CProjectHelper.delete(fCProject);
|
CProjectHelper.delete(fCProject);
|
||||||
|
@ -230,7 +232,7 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
// make sure the ast is correct
|
// make sure the ast is correct
|
||||||
ITranslationUnit tu= (ITranslationUnit) fCProject.findElement(new Path(fileName));
|
ITranslationUnit tu= (ITranslationUnit) fCProject.findElement(new Path(fileName));
|
||||||
IASTTranslationUnit ast= tu.getAST();
|
IASTTranslationUnit ast= tu.getAST();
|
||||||
IASTName name= (IASTName) ast.selectNodeForLocation(tu.getLocation().toOSString(), indexOfDecl, funcName.length());
|
IASTName name= (IASTName) ast.selectNodeForLocation(tu.getLocation().toString(), indexOfDecl, funcName.length());
|
||||||
IBinding astBinding= name.resolveBinding();
|
IBinding astBinding= name.resolveBinding();
|
||||||
|
|
||||||
IName[] astDecls= ast.getDeclarations(astBinding);
|
IName[] astDecls= ast.getDeclarations(astBinding);
|
||||||
|
@ -697,6 +699,7 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
fIndex.acquireReadLock();
|
fIndex.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
final IndexFilter NON_FUNCTIONS = new IndexFilter() {
|
final IndexFilter NON_FUNCTIONS = new IndexFilter() {
|
||||||
|
@Override
|
||||||
public boolean acceptBinding(IBinding binding) {
|
public boolean acceptBinding(IBinding binding) {
|
||||||
return !(binding instanceof IFunction);
|
return !(binding instanceof IFunction);
|
||||||
}
|
}
|
||||||
|
@ -730,6 +733,7 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
fIndex.acquireReadLock();
|
fIndex.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
final IndexFilter NON_CLASS = new IndexFilter() {
|
final IndexFilter NON_CLASS = new IndexFilter() {
|
||||||
|
@Override
|
||||||
public boolean acceptBinding(IBinding binding) {
|
public boolean acceptBinding(IBinding binding) {
|
||||||
return !(binding instanceof ICPPClassType);
|
return !(binding instanceof ICPPClassType);
|
||||||
}
|
}
|
||||||
|
@ -1056,6 +1060,7 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
|
|
||||||
final ITranslationUnit tu= (ITranslationUnit) fCProject.findElement(new Path("source.cpp"));
|
final ITranslationUnit tu= (ITranslationUnit) fCProject.findElement(new Path("source.cpp"));
|
||||||
Thread th= new Thread() {
|
Thread th= new Thread() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
tu.getAST(fIndex, ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT);
|
tu.getAST(fIndex, ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT);
|
||||||
|
|
|
@ -803,4 +803,13 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
|
||||||
assertTrue(scope instanceof ICPPNamespaceScope);
|
assertTrue(scope instanceof ICPPNamespaceScope);
|
||||||
assertEquals("NSB", scope.getScopeName().toString());
|
assertEquals("NSB", scope.getScopeName().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// namespace N { namespace M {}}
|
||||||
|
|
||||||
|
// namespace N {using namespace N::M;}
|
||||||
|
// using namespace N;
|
||||||
|
// void test() {x;}
|
||||||
|
public void testEndlessLoopWithUsingDeclaration_Bug209813() throws DOMException {
|
||||||
|
getProblemFromASTName("x;", 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue