mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Testcase for bug 183930, comments in inactive code.
This commit is contained in:
parent
0ead6fa666
commit
8fb26410f5
2 changed files with 21 additions and 1 deletions
|
@ -11,6 +11,8 @@
|
|||
******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
|
@ -22,6 +24,10 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
|||
*/
|
||||
public class CommentTests extends AST2BaseTest {
|
||||
|
||||
public static TestSuite suite() {
|
||||
return suite(CommentTests.class);
|
||||
}
|
||||
|
||||
public void testCountCommentsInHeaderFile() throws ParserException{
|
||||
IASTTranslationUnit tu = parse(getHSource(), ParserLanguage.CPP, false, true, true);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
@ -188,4 +194,18 @@ public class CommentTests extends AST2BaseTest {
|
|||
return buffer.toString();
|
||||
}
|
||||
|
||||
// #ifdef xxx
|
||||
// // comment1
|
||||
// #else
|
||||
// // comment2
|
||||
// #endif
|
||||
public void _testCommentsInInactiveCode_bug183930() throws Exception {
|
||||
StringBuffer code= getContents(1)[0];
|
||||
IASTTranslationUnit tu = parse(code.toString(), ParserLanguage.CPP, false, true, true);
|
||||
IASTComment[] comments = tu.getComments();
|
||||
|
||||
assertEquals(2, comments.length);
|
||||
assertEquals("// comment1", new String(comments[0].getComment()));
|
||||
assertEquals("// comment2", new String(comments[0].getComment()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class DOMParserTestSuite extends TestCase {
|
|||
suite.addTestSuite( DOMSelectionParseTest.class );
|
||||
suite.addTestSuite( GCCCompleteParseExtensionsTest.class );
|
||||
suite.addTestSuite(DOMPreprocessorInformationTest.class);
|
||||
suite.addTestSuite(CommentTests.class);
|
||||
suite.addTest(CommentTests.suite());
|
||||
suite.addTest( CompletionTestSuite.suite() );
|
||||
return suite;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue