From 0b6dc5ff4b482a5cc157ed7ae95c1d9f175461cd Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 9 Sep 2010 13:43:12 +0000 Subject: [PATCH] Bug 324842: Testcase. --- .../tests/ast2/ASTCPPSpecDefectTests.java | 72 +++++++++++++++++++ .../parser/tests/ast2/DOMParserTestSuite.java | 1 + 2 files changed, 73 insertions(+) create mode 100644 core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java new file mode 100644 index 00000000000..c5e82ec6c19 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2010 Wind River Systems, Inc. and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Markus Schorn (Wind River Systems) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.core.parser.tests.ast2; + +import java.util.Iterator; + +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.dom.ast.IProblemBinding; +import org.eclipse.cdt.core.parser.ParserLanguage; + +public class ASTCPPSpecDefectTests extends AST2BaseTest { + + public ASTCPPSpecDefectTests() { + } + + public ASTCPPSpecDefectTests(String name) { + super(name); + } + + public static TestSuite suite() { + return suite(ASTCPPSpecDefectTests.class); + } + + protected IASTTranslationUnit parseAndCheckBindings(String code) throws Exception { + IASTTranslationUnit tu = parse(code, ParserLanguage.CPP); + CPPNameCollector col = new CPPNameCollector(); + tu.accept(col); + assertNoProblemBindings(col); + return tu; + } + + private IASTTranslationUnit parseAndCheckBindings() throws Exception { + String code= getAboveComment(); + return parseAndCheckBindings(code); + } + + protected void assertNoProblemBindings(CPPNameCollector col) { + Iterator i = col.nameList.iterator(); + while (i.hasNext()) { + IASTName n = (IASTName) i.next(); + assertFalse(n.resolveBinding() instanceof IProblemBinding); + } + } + + public void testDummy() {} + + // // C++ defect #33 + // namespace ns { + // struct S {}; + // void fp(void (*)(int)); + // } + // void f0(ns::S); + // void f0(int); + // + // void test() { + // fp(f0); + // } + public void _testADLForOverloadSet_324842() throws Exception { + parseAndCheckBindings(); + } +} diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMParserTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMParserTestSuite.java index 4d40abb89f2..f29296daa4d 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMParserTestSuite.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMParserTestSuite.java @@ -27,6 +27,7 @@ public class DOMParserTestSuite extends TestCase { suite.addTest(AST2Tests.suite()); suite.addTestSuite(GCCTests.class); suite.addTest(AST2CPPTests.suite()); + suite.addTest(ASTCPPSpecDefectTests.suite()); suite.addTest(AST2CPPImplicitNameTests.suite()); suite.addTest(AST2TemplateTests.suite()); suite.addTestSuite(QuickParser2Tests.class);