diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTestBase.java new file mode 100644 index 00000000000..6defd817238 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTestBase.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2017 Nathan Ridge. + * 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 + *******************************************************************************/ +package org.eclipse.cdt.core.parser.tests.ast2; + +import static org.eclipse.cdt.core.parser.ParserLanguage.CPP; + +import java.io.IOException; + +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.internal.core.parser.ParserException; + +public class AST2CPPTestBase extends AST2TestBase { + public AST2CPPTestBase() { + } + + public AST2CPPTestBase(String name) { + super(name); + } + + protected IASTTranslationUnit parseAndCheckBindings(String code) throws Exception { + return parseAndCheckBindings(code, CPP); + } + + protected IASTTranslationUnit parseAndCheckBindings() throws Exception { + String code= getAboveComment(); + return parseAndCheckBindings(code); + } + + protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException { + return getAssertionHelper(CPP); + } +} diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index f7f7b791973..a3e36fa76f4 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -25,7 +25,6 @@ import static org.eclipse.cdt.core.parser.tests.VisibilityAsserts.assertVisibili import static org.junit.Assert.assertNotEquals; import java.io.BufferedReader; -import java.io.IOException; import java.io.StringReader; import java.util.Arrays; import java.util.HashSet; @@ -159,7 +158,7 @@ import org.eclipse.cdt.internal.core.parser.ParserException; import junit.framework.TestSuite; -public class AST2CPPTests extends AST2TestBase { +public class AST2CPPTests extends AST2CPPTestBase { public AST2CPPTests() { } @@ -172,19 +171,6 @@ public class AST2CPPTests extends AST2TestBase { return suite(AST2CPPTests.class); } - protected IASTTranslationUnit parseAndCheckBindings(String code) throws Exception { - return parseAndCheckBindings(code, CPP); - } - - protected IASTTranslationUnit parseAndCheckBindings() throws Exception { - String code= getAboveComment(); - return parseAndCheckBindings(code); - } - - protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException { - return getAssertionHelper(CPP); - } - private void assertProblemBinding(int id, IBinding b) { assertTrue(b instanceof IProblemBinding); assertEquals(id, ((IProblemBinding) b).getID()); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index 3718b1c15ac..b1fdf5ce787 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -24,8 +24,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getNestedType; import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateType; -import java.io.IOException; - import org.eclipse.cdt.core.dom.IName; import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; @@ -103,11 +101,10 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope; import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; -import org.eclipse.cdt.internal.core.parser.ParserException; import junit.framework.TestSuite; -public class AST2TemplateTests extends AST2TestBase { +public class AST2TemplateTests extends AST2CPPTestBase { public AST2TemplateTests() { } @@ -120,19 +117,6 @@ public class AST2TemplateTests extends AST2TestBase { return suite(AST2TemplateTests.class); } - private IASTTranslationUnit parseAndCheckBindings() throws Exception { - return parseAndCheckBindings(getAboveComment()); - } - - private IASTTranslationUnit parseAndCheckBindings(final String code) throws Exception { - return parseAndCheckBindings(code, CPP); - } - - protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException { - String code= getAboveComment(); - return new AST2AssertionHelper(code, true); - } - private NameCollector getNameCollector(IASTTranslationUnit ast) { NameCollector collector = new NameCollector(); ast.accept(collector); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java index 09f7c18b63a..800ae1308b7 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/cxx14/ReturnTypeDeductionTests.java @@ -10,19 +10,14 @@ package org.eclipse.cdt.core.parser.tests.ast2.cxx14; import org.eclipse.cdt.core.dom.ast.IProblemType; import org.eclipse.cdt.core.dom.ast.IType; import org.eclipse.cdt.core.dom.ast.ITypedef; -import org.eclipse.cdt.core.parser.ParserLanguage; -import org.eclipse.cdt.core.parser.tests.ast2.AST2TestBase; +import org.eclipse.cdt.core.parser.tests.ast2.AST2CPPTestBase; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClosureType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance; import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; -public class ReturnTypeDeductionTests extends AST2TestBase { - private BindingAssertionHelper getAssertionHelper() throws Exception { - return getAssertionHelper(ParserLanguage.CPP); - } - +public class ReturnTypeDeductionTests extends AST2CPPTestBase { private void assertReturnType(String functionName, IType returnType) throws Exception { BindingAssertionHelper bh = getAssertionHelper(); ICPPFunction f = bh.assertNonProblem(functionName);