Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
index f82112495b3..0f18f070973 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java
@@ -58,6 +58,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
+import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfdefStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorPragmaStatement;
@@ -7321,4 +7322,19 @@ public class AST2Tests extends AST2BaseTest {
bh.assertNonProblem("a;", 1);
}
+ // #ifdef A // active, not taken.
+ // #ifdef B // inactive, not taken.
+ // #endif // inactive
+ // #endif // active
+ public void testInactivePreprocessingStatements() throws Exception {
+ IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment());
+ IASTPreprocessorStatement[] stmts= tu.getAllPreprocessorStatements();
+ assertTrue(stmts[0].isActive());
+ assertFalse(stmts[1].isActive());
+ assertFalse(stmts[2].isActive());
+ assertTrue(stmts[3].isActive());
+
+ assertFalse(((IASTPreprocessorIfdefStatement) stmts[0]).taken());
+ assertFalse(((IASTPreprocessorIfdefStatement) stmts[1]).taken());
+ }
}

Back to the top