mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
Add failing testcase for 162180
This commit is contained in:
parent
4327e91e76
commit
2d97518819
2 changed files with 27 additions and 1 deletions
|
@ -40,6 +40,7 @@ import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorObjectStyleMacroDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorUndefStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||
|
@ -63,7 +64,11 @@ public class DOMLocationTests extends AST2BaseTest {
|
|||
|
||||
private static final String _TEXT_ = "<text>"; //$NON-NLS-1$
|
||||
|
||||
public void testBaseCase() throws ParserException {
|
||||
public DOMLocationTests(String name) {
|
||||
setName(name);
|
||||
}
|
||||
|
||||
public void testBaseCase() throws ParserException {
|
||||
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
|
||||
: null) {
|
||||
IASTTranslationUnit tu = parse("int x;", p); //$NON-NLS-1$
|
||||
|
@ -444,6 +449,25 @@ public class DOMLocationTests extends AST2BaseTest {
|
|||
}
|
||||
}
|
||||
|
||||
public void _testBug162180() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "#include <notfound.h>\n"); //$NON-NLS-1$
|
||||
int declOffset= buffer.length();
|
||||
buffer.append( "int x;\n"); //$NON-NLS-1$
|
||||
String code = buffer.toString();
|
||||
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
|
||||
: null) {
|
||||
IASTTranslationUnit tu = parse(code, p, false, false);
|
||||
IASTDeclaration[] decls= tu.getDeclarations();
|
||||
assertEquals( decls.length, 1 );
|
||||
IASTPreprocessorStatement [] statements = tu.getAllPreprocessorStatements();
|
||||
assertEquals( statements.length, 0 );
|
||||
IASTProblem[] problems = tu.getPreprocessorProblems();
|
||||
assertEquals( problems.length, 1 );
|
||||
assertSoleLocation( decls[0], code.indexOf( "int x;"), "int x;".length() ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
public void testBug85820() throws Exception {
|
||||
String code = "int *p = (int []){2, 4};"; //$NON-NLS-1$
|
||||
IASTTranslationUnit tu = parse( code, ParserLanguage.C );
|
||||
|
|
|
@ -16,6 +16,7 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
|
||||
import org.eclipse.cdt.core.parser.tests.prefix.CompletionTestSuite;
|
||||
import org.eclipse.cdt.core.tests.FailingTest;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -31,6 +32,7 @@ public class DOMParserTestSuite extends TestCase {
|
|||
suite.addTestSuite( QuickParser2Tests.class );
|
||||
suite.addTestSuite( CompleteParser2Tests.class );
|
||||
suite.addTestSuite( DOMLocationTests.class );
|
||||
suite.addTest( new FailingTest(new DOMLocationTests("_testBug162180"), 162180) );
|
||||
suite.addTestSuite( DOMLocationMacroTests.class );
|
||||
suite.addTest( DOMLocationInclusionTests.suite() );
|
||||
suite.addTestSuite( AST2KnRTests.class );
|
||||
|
|
Loading…
Add table
Reference in a new issue