mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
move older tests to new-style framework
This commit is contained in:
parent
7af8d03be8
commit
65701e2d38
2 changed files with 3815 additions and 3917 deletions
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
|
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
|
||||||
|
@ -472,4 +473,35 @@ public class AST2BaseTest extends BaseTestCase {
|
||||||
return name.resolveBinding();
|
return name.resolveBinding();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final protected IASTTranslationUnit parseAndCheckBindings( String code, ParserLanguage lang ) throws Exception {
|
||||||
|
return parseAndCheckBindings(code, lang, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
final protected IASTTranslationUnit parseAndCheckBindings( String code, ParserLanguage lang, boolean useGnuExtensions) throws Exception {
|
||||||
|
IASTTranslationUnit tu = parse( code, lang, useGnuExtensions );
|
||||||
|
CNameCollector col = new CNameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
assertNoProblemBindings( col );
|
||||||
|
return tu;
|
||||||
|
}
|
||||||
|
|
||||||
|
final protected void assertNoProblemBindings(CNameCollector col) {
|
||||||
|
Iterator i = col.nameList.iterator();
|
||||||
|
while (i.hasNext()) {
|
||||||
|
IASTName n = (IASTName) i.next();
|
||||||
|
assertFalse(n.resolveBinding() instanceof IProblemBinding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final protected void assertProblemBindings(CNameCollector col, int count) {
|
||||||
|
Iterator i = col.nameList.iterator();
|
||||||
|
int sum = 0;
|
||||||
|
while (i.hasNext()) {
|
||||||
|
IASTName n = (IASTName) i.next();
|
||||||
|
if (n.getBinding() instanceof IProblemBinding)
|
||||||
|
++sum;
|
||||||
|
}
|
||||||
|
assertEquals(count, sum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue