From 6f7c1b7904b88ada893a589d8c3ce77347ae69d8 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 3 Oct 2011 20:09:17 -0700 Subject: [PATCH] Added another failing test. --- .../tests/IndexMultiVariantHeaderTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiVariantHeaderTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiVariantHeaderTest.java index fcd8144b39b..7829ca8ebec 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiVariantHeaderTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexMultiVariantHeaderTest.java @@ -14,6 +14,7 @@ import junit.framework.TestSuite; import org.eclipse.cdt.core.dom.ast.IFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; /** * Tests for header files included in multiple variants. @@ -102,4 +103,33 @@ public class IndexMultiVariantHeaderTest extends IndexBindingResolutionTestBase getBindingFromASTName("f1(NULL)", 2, ICPPFunction.class); getBindingFromASTName("f2(NULL, 1)", 2, ICPPFunction.class); } + + // a.h + // external int X; + + // b.h + // #define X y + // #include "a.h" + // #undef X + // #define X z + // #include "a.h" + + // a.cpp * + // #define X x + // #include "a.h" + // static void test() { + // x = 0; + // } + + // b.cpp * + // #include "b.h" + // static void test() { + // y = 0; + // z = 0; + // } + public void testSignificantMacroDetection() throws Exception { + getBindingFromASTName("x = 0", 1, ICPPVariable.class); + getBindingFromASTName("y = 0", 1, ICPPVariable.class); + getBindingFromASTName("z = 0", 1, ICPPVariable.class); + } }