diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java index 053682f6617..b1ea12dab27 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPImplicitNameTests.java @@ -50,7 +50,7 @@ public class AST2CPPImplicitNameTests extends AST2TestBase { protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException { String code= getAboveComment(); - return new BindingAssertionHelper(code, ParserLanguage.CPP); + return new AST2AssertionHelper(code, ParserLanguage.CPP); } protected IASTImplicitName[] getImplicitNames(IASTTranslationUnit tu, String contents, String section, int len) { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java index 9a0d2d85137..c40c3f248e5 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPSpecTest.java @@ -1895,7 +1895,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { final String code = getAboveComment(); parse(code, ParserLanguage.CPP, true, 1); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); IFunction f= ba.assertNonProblem("f", 1, IFunction.class); isTypeEqual(f.getType(), "void (int (*)(C))"); } @@ -1906,7 +1906,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test8_2s7b() throws Exception { final String code = getAboveComment(); parse(code, ParserLanguage.CPP, true, 0); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); IFunction f= ba.assertNonProblem("h", 1, IFunction.class); isTypeEqual(f.getType(), "void (int * (*)(C *))"); } @@ -2653,7 +2653,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { String[] problems= {"g"}; final String code = getAboveComment(); IASTTranslationUnit tu= parse(code, ParserLanguage.CPP, problems); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("g();", 1); bh.assertProblem("g(); //error", 1); } @@ -3672,7 +3672,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test12_4s12() throws Exception { final String code = getAboveComment(); parse(code, ParserLanguage.CPP, false, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPFunction dtor= bh.assertNonProblem("~B() {", 2); ICPPFunction d= bh.assertNonProblem("~B(); //1", 2); @@ -4968,7 +4968,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_5_6_1s8a() throws Exception { final String content= getAboveComment(); IASTTranslationUnit tu= parse(content, ParserLanguage.CPP, true, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); ICPPFunctionTemplate f1= bh.assertNonProblem("f/*1*/", 1); ICPPFunctionTemplate f2= bh.assertNonProblem("f/*2*/", 1); ICPPFunctionTemplate f3= bh.assertNonProblem("f/*3*/", 1); @@ -4998,7 +4998,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_5_6_2s3() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IBinding op1= bh.assertNonProblem("operator*(R&)", -4); IASTImplicitName name= bh.assertImplicitName("* a", 1, ICPPFunction.class); ICPPTemplateInstance inst= (ICPPTemplateInstance) name.resolveBinding(); @@ -5239,7 +5239,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_6_2s2() throws Exception { final String code = getAboveComment(); parse(code, ParserLanguage.CPP, true, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPUnknownBinding unknown= bh.assertNonProblem("B", 4); unknown= bh.assertNonProblem("T::A", 4); unknown= bh.assertNonProblem("B::i", 7); @@ -5256,7 +5256,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_6_2s3() throws Exception { final String content= getAboveComment(); IASTTranslationUnit tu= parse(content, ParserLanguage.CPP, true, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); IVariable v= bh.assertNonProblem("a;", 1); IType t= v.getType(); assertInstance(t, ITypedef.class); @@ -5281,7 +5281,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_6_2s4() throws Exception { final String content= getAboveComment(); parse(content, ParserLanguage.CPP, true, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); IBinding b= bh.assertNonProblem("b;", 1); assertEquals("Y", b.getOwner().getName()); b= bh.assertNonProblem("a = i", 1); @@ -5771,7 +5771,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2s5() throws Exception { final String content= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(1, 'c')", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -5801,7 +5801,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // int j = f(0); // invalid array public void _test14_8_2s8b() throws Exception { final String content= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); bh.assertNonProblem("f(0)", -3); bh.assertProblem("f(0)", -3); } @@ -5811,7 +5811,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_8_2s8c() throws Exception { final String content= getAboveComment(); IASTTranslationUnit tu= parse(content, ParserLanguage.CPP, true, 2); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); bh.assertProblem("f<", 1); bh.assertProblem("f", 6); } @@ -5838,7 +5838,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2s8d() throws Exception { final String content= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); bh.assertProblem("f", 0); bh.assertProblem("f", 0); bh.assertProblem("g", 0); @@ -5850,7 +5850,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_8_2s8e() throws Exception { final String code = getAboveComment(); parse(code, ParserLanguage.CPP, true, 2); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertProblem("f", 0); } @@ -5861,7 +5861,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_8_2s8f() throws Exception { final String code = getAboveComment(); parse(code, ParserLanguage.CPP, true, 2); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertProblem("f", 0); } @@ -5891,7 +5891,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_1s1a() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f({1,2,3})", 1); @@ -5909,7 +5909,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_1s1b() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(x, y, z)", 1); @@ -5927,7 +5927,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // // would bind an rvalue reference to an lvalue public void test14_8_2_1s3() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(i)", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -5944,7 +5944,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // int i = f(g); // calls f(int (*)(int)) public void test14_8_2_1s7() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(g)", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -5958,7 +5958,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // int i = f(1, g); // calls f(int, int (*)(int)) public void test14_8_2_1s8() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(1, g)", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -5972,7 +5972,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // int i = f(1, g); // calls f(int, int (*)(int)) public void test14_8_2_1s9() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(1, g)", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -6012,7 +6012,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { final String code= getAboveComment(); parse(code, ParserLanguage.CPP, true, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPFunction g1= bh.assertNonProblem("g(Tuple)", 1); ICPPFunction g2= bh.assertNonProblem("g(Tuple)", 1); ICPPFunction g3= bh.assertNonProblem("g(Tuple)", 1); @@ -6033,7 +6033,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s5() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertProblem("g({1,2,3})", 1); } @@ -6063,7 +6063,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s7b() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(g1)", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -6105,7 +6105,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s10() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(i)", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -6121,7 +6121,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s14() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertProblem("f(v)", 1); } @@ -6139,7 +6139,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s15() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f1(v)", 2); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -6164,7 +6164,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s16a() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; bh.assertProblem("g(a1)", 1); inst= bh.assertNonProblem("g<0>(a1)", -4); @@ -6212,7 +6212,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s17() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; bh.assertProblem("f(a)", 1); inst= bh.assertNonProblem("f<1>(a)", -3); @@ -6234,7 +6234,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s18() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; bh.assertProblem("f(&g)", 1); inst= bh.assertNonProblem("f(&h)", 1); @@ -6250,7 +6250,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s19() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPTemplateInstance inst; inst= bh.assertNonProblem("f(1)", 1); assertEquals("", ASTTypeUtil.getArgumentListString(inst.getTemplateArguments(), true)); @@ -6298,7 +6298,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { // } public void test14_8_2_5s22() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPFunctionTemplate f1= bh.assertNonProblem("f(Args ... args)", 1); ICPPFunctionTemplate f2= bh.assertNonProblem("f(T1 a1, Args ... args)", 1); ICPPFunctionTemplate f3= bh.assertNonProblem("f(T1 a1, T2 a2)", 1); @@ -6876,7 +6876,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_5_6_1s5() throws Exception { final String content= getAboveComment(); IASTTranslationUnit tu= parse(content, ParserLanguage.CPP, true, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); ICPPFunctionTemplate f1= bh.assertNonProblem("f/*1*/", 1); ICPPFunctionTemplate f2= bh.assertNonProblem("f/*2*/", 1); ICPPFunctionTemplate f3= bh.assertNonProblem("f/*3*/", 1); @@ -6890,7 +6890,7 @@ public class AST2CPPSpecTest extends AST2SpecTestBase { public void test14_5_6_1s6() throws Exception { final String content= getAboveComment(); IASTTranslationUnit tu= parse(content, ParserLanguage.CPP, true, 0); - BindingAssertionHelper bh= new BindingAssertionHelper(content, true); + BindingAssertionHelper bh= new AST2AssertionHelper(content, true); ICPPFunctionTemplate f1= bh.assertNonProblem("f/*1*/", 1); ICPPFunctionTemplate f2= bh.assertNonProblem("f/*2*/", 1); assertSame(f1, f2); 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 0883dd7c21f..a8629e522cd 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 @@ -1709,7 +1709,7 @@ public class AST2CPPTests extends AST2TestBase { // // A a = A(1); public void testConstructorCall() throws Exception { - BindingAssertionHelper bh = new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh = new AST2AssertionHelper(getAboveComment(), CPP); ICPPConstructor ctor = bh.assertNonProblem("A(int x)", "A", ICPPConstructor.class); ICPPClassType classType = bh.assertNonProblem("A(1)", "A", ICPPClassType.class); assertSame(ctor.getOwner(), classType); @@ -1744,7 +1744,7 @@ public class AST2CPPTests extends AST2TestBase { // A a = A(b); // } public void _testConversionOperator() throws Exception { - BindingAssertionHelper bh = new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh = new AST2AssertionHelper(getAboveComment(), CPP); ICPPMethod oper = bh.assertNonProblem("operator A", "operator A", ICPPMethod.class); ICPPMethod conv = bh.assertNonProblem("A(b)", "A", ICPPMethod.class); // This assertion fails because conv is the copy ctor A(const A&), not the conversion operator B::operator A() @@ -2426,7 +2426,7 @@ public class AST2CPPTests extends AST2TestBase { // }; public void testFriend_275358() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPClassType A = bh.assertNonProblem("A", 1); IFunction set = bh.assertNonProblem("set()", 3); IFunction m = bh.assertNonProblem("Other::m()", 8); @@ -4027,7 +4027,7 @@ public class AST2CPPTests extends AST2TestBase { // // B a = B(1); public void testTypedefConstructorCall() throws Exception { - BindingAssertionHelper bh = new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh = new AST2AssertionHelper(getAboveComment(), CPP); ICPPConstructor ctor = bh.assertNonProblem("A(int x)", "A", ICPPConstructor.class); ITypedef typedef = bh.assertNonProblem("B(1)", "B", ITypedef.class); assertSame(ctor.getOwner(), typedef.getType()); @@ -5159,7 +5159,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testRankingQualificationConversions_c() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPFunction f1= bh.assertNonProblem("f(const int&)", 1); ICPPFunction f2= bh.assertNonProblem("f(int&)", 1); @@ -5816,7 +5816,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testQualifiedMemberDeclaration_222026() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IBinding b= bh.assertNonProblem("member1", 7); IBinding b2= bh.assertNonProblem("member1(){", 7); @@ -5826,7 +5826,7 @@ public class AST2CPPTests extends AST2TestBase { assertEquals("Test", m1.getScope().getScopeName().toString()); assertSame(b, b2); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); b= bh.assertNonProblem("member2", 7); b2= bh.assertNonProblem("member2();", 7); assertTrue(b instanceof ICPPMethod); @@ -5836,7 +5836,7 @@ public class AST2CPPTests extends AST2TestBase { assertSame(b, b2); // different resolution order - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); b2= bh.assertNonProblem("member1(){", 7); b= bh.assertNonProblem("member1", 7); assertTrue(b instanceof ICPPMethod); @@ -5845,7 +5845,7 @@ public class AST2CPPTests extends AST2TestBase { assertEquals("Test", m1.getScope().getScopeName().toString()); assertSame(b, b2); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); b2= bh.assertNonProblem("member2();", 7); b= bh.assertNonProblem("member2", 7); assertTrue(b instanceof ICPPMethod); @@ -5864,7 +5864,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testQualifiedMemberDeclarationInNamespace_222026() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IBinding b= bh.assertNonProblem("member1", 7); IBinding b2= bh.assertNonProblem("member1(){", 7); @@ -5874,7 +5874,7 @@ public class AST2CPPTests extends AST2TestBase { assertEquals("Test", m1.getScope().getScopeName().toString()); assertSame(b, b2); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); b= bh.assertNonProblem("member2", 7); b2= bh.assertNonProblem("member2();", 7); assertTrue(b instanceof ICPPFunction); @@ -5884,7 +5884,7 @@ public class AST2CPPTests extends AST2TestBase { assertSame(b, b2); // different resolution order - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); b2= bh.assertNonProblem("member1(){", 7); b= bh.assertNonProblem("member1", 7); assertTrue(b instanceof ICPPFunction); @@ -5893,7 +5893,7 @@ public class AST2CPPTests extends AST2TestBase { assertEquals("Test", m1.getScope().getScopeName().toString()); assertSame(b, b2); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); b2= bh.assertNonProblem("member2();", 7); b= bh.assertNonProblem("member2", 7); assertTrue(b instanceof ICPPFunction); @@ -6512,7 +6512,7 @@ public class AST2CPPTests extends AST2TestBase { final String comment= getAboveComment(); final boolean[] isCpps= {false, true}; for (boolean isCpp : isCpps) { - BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); + BindingAssertionHelper ba= new AST2AssertionHelper(comment, isCpp); ba.assertProblem("a; // should not resolve", 1); } } @@ -6534,7 +6534,7 @@ public class AST2CPPTests extends AST2TestBase { // }; public void testNamespaceQualifiedOperator_256840() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("operator ns::A", 14); parseAndCheckBindings(code, CPP); } @@ -6558,7 +6558,7 @@ public class AST2CPPTests extends AST2TestBase { final String comment= getAboveComment(); final boolean[] isCpps= {false, true}; for (boolean isCpp : isCpps) { - BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); + BindingAssertionHelper ba= new AST2AssertionHelper(comment, isCpp); ba.assertNonProblem("f(p)", 1, IFunction.class); } } @@ -6576,7 +6576,7 @@ public class AST2CPPTests extends AST2TestBase { final String comment= getAboveComment(); final boolean[] isCpps= {false, true}; for (boolean isCpp : isCpps) { - BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); + BindingAssertionHelper ba= new AST2AssertionHelper(comment, isCpp); IFunction decl= ba.assertNonProblem("f(Incomplete* p)", 1, IFunction.class); IFunction func= ba.assertNonProblem("f(0)", 1, IFunction.class); assertSame(decl, func); @@ -7009,7 +7009,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testMemberFunctionDisambiguationByCVness_238409() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPMethod bar_cv= bh.assertNonProblem("bar();/*1*/", 3, ICPPMethod.class); ICPPMethod bar_v= bh.assertNonProblem("bar();/*2*/", 3, ICPPMethod.class); @@ -7126,7 +7126,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testAmbiguityResolutionInCondition_263158() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); ba.assertNonProblem("A*", 1, ICPPClassType.class); ba.assertNonProblem("a", 1, ICPPVariable.class); ba.assertNonProblem("B*", 1, ICPPVariable.class); @@ -7140,7 +7140,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testAmbiguityResolutionInDeleteExpression_428922() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); ba.assertNonProblem("type)", 4, ITypedef.class); ba.assertNonProblem("ptr);", 3, ICPPVariable.class); @@ -7208,7 +7208,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testConstructorTemplateInImplicitConversion_264314() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); ba.assertNonProblem("onRange(ir)", 7); parseAndCheckBindings(code, CPP); } @@ -7228,7 +7228,7 @@ public class AST2CPPTests extends AST2TestBase { // CT ct2; public void testConstTypedef_264474() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); ba.assertNonProblem("check(p2)", 5); IBinding ct1= ba.assertNonProblem("CT", 8); IBinding ct2= ba.assertNonProblem("CT", 9); @@ -7275,7 +7275,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testMemberPtrs_264479() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); ba.assertNonProblem("mpr(&X::f)", 3); ba.assertNonProblem("mpr(&X::m)", 3); ba.assertNonProblem("mprc(&X::cm)", 4); @@ -7452,7 +7452,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testPointerToArrayWithDefaultVal_267184() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); ICPPParameter p= ba.assertNonProblem("names", 5); assertTrue(p.hasDefaultValue()); IType t= p.getType(); @@ -7643,7 +7643,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testDerivedToBaseConversion_269318() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper ba= new BindingAssertionHelper(code, true); + BindingAssertionHelper ba= new AST2AssertionHelper(code, true); ICPPFunction t= ba.assertNonProblem("test(d1);", 4, ICPPFunction.class); ICPPClassType ct= (ICPPClassType) t.getParameters()[0].getType(); assertEquals("C", ct.getName()); @@ -7938,7 +7938,7 @@ public class AST2CPPTests extends AST2TestBase { final String code = getAboveComment(); parseAndCheckBindings(code, CPP); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPClassType S= bh.assertNonProblem("S*", 1); assertNull(S.getOwner()); @@ -7979,7 +7979,7 @@ public class AST2CPPTests extends AST2TestBase { public void testMethodTemplateWithSameName_292051() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code, CPP); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPMethod m= bh.assertNonProblem("t<1>", 1); assertTrue(m.isInline()); } @@ -8049,7 +8049,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testUserDefinedConversion_222444c() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("foo(c);", 3); bh.assertProblem("foo(cc);", 3); } @@ -8098,7 +8098,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testLookupInConstructorChainInitializer_293566() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("B>(1)", 1); parseAndCheckBindings(code, CPP); } @@ -8128,7 +8128,7 @@ public class AST2CPPTests extends AST2TestBase { public void testFunctionDeclViaTypedef_86495() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code, CPP); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPFunctionTemplate template= bh.assertNonProblem("functionTemplate", 16); assertNotNull(template.getType()); @@ -8272,7 +8272,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testRValueReference_294730() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IBinding foo1= bh.assertNonProblem("foo(const A&)", 3); IBinding foo2= bh.assertNonProblem("foo(A&&)", 3); IBinding b; @@ -8312,7 +8312,7 @@ public class AST2CPPTests extends AST2TestBase { // RRI&& r5 = i; // r5 has the type int&& public void testRValueReferenceTypedefs_294730() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IVariable v; v= bh.assertNonProblem("r1", 2); assertEquals("int &", ASTTypeUtil.getType(v.getType())); @@ -8359,7 +8359,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testDirectBinding_294730() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("dref(d)", 4); bh.assertNonProblem("cdref(d)", 5); bh.assertNonProblem("aref(b)", 4); @@ -8443,7 +8443,7 @@ public class AST2CPPTests extends AST2TestBase { final String code= contents[0].toString(); final String end= contents[2].toString(); parseAndCheckBindings(code + end, CPP); - BindingAssertionHelper bh= new BindingAssertionHelper(code + contents[1] + end, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code + contents[1] + end, true); bh.assertProblem("sink3(source())", 5); bh.assertProblem("sink3(csource())", 5); bh.assertProblem("sink3(z7)", 5); @@ -8483,7 +8483,7 @@ public class AST2CPPTests extends AST2TestBase { public void testADL_299101() throws Exception { String code= getAboveComment(); parseAndCheckBindings(code, CPP); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction inns= bh.assertNonProblem("f(ns::A, char)", 1); IFunction glob= bh.assertNonProblem("f(ns::A, int)", 1); @@ -8510,7 +8510,7 @@ public class AST2CPPTests extends AST2TestBase { public void testDecltype_294730() throws Exception { String code= getAboveComment(); parseAndCheckBindings(code, CPP); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction f= bh.assertNonProblem("t1", 2); assertEquals("const int &&", ASTTypeUtil.getType(f.getType().getReturnType())); f= bh.assertNonProblem("t2", 2); @@ -8705,7 +8705,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testListInitialization_302412b() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("f({1,2,3})", 1); bh.assertNonProblem("f({'a','b'})", 1); bh.assertProblem("f({1.0})", 1); @@ -8755,7 +8755,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testListInitialization_302412c() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("e({ 'a', 'b' })", 1); bh.assertNonProblem("g({ 'a', 'b' })", 1); bh.assertProblem("g({ 1.0, 1.0 })", 1); @@ -8779,7 +8779,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testListInitialization_302412d() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("f({'a', 'b'})", 1); // not detected by CDT // bh.assertProblem("f({1.0})", 1); @@ -8799,7 +8799,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testListInitialization_302412e() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); // not detected by CDT // bh.assertProblem("g({1})", 1); bh.assertNonProblem("h({'a'})", 1); @@ -8992,7 +8992,7 @@ public class AST2CPPTests extends AST2TestBase { // auto y = { 1.0, 5 }; // Error - inconsistent types in the array initializer. public void testAutoType_289542() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPVariable b= bh.assertNonProblem("b =", 1); assertEquals("A", ASTTypeUtil.getType(b.getType())); ICPPVariable c= bh.assertNonProblem("c(a)", "c"); @@ -9037,7 +9037,7 @@ public class AST2CPPTests extends AST2TestBase { // struct B { static auto b = 1; }; // Auto-typed static fields are ok. public void testAutoType_305987() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPVariable a= bh.assertNonProblem("a =", 1); IProblemType pt= (IProblemType) a.getType(); assertEquals(ISemanticProblem.TYPE_AUTO_FOR_NON_STATIC_FIELD, pt.getID()); @@ -9048,7 +9048,7 @@ public class AST2CPPTests extends AST2TestBase { // auto fpif2(int)->int(*)(int) {} public void testNewFunctionDeclaratorSyntax_305972() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPFunction f= bh.assertNonProblem("fpif1", 0); assertEquals("int (* (int))(int)", ASTTypeUtil.getType(f.getType())); @@ -9065,7 +9065,7 @@ public class AST2CPPTests extends AST2TestBase { // enum EUnscoped3 : int; public void testScopedEnums_305975a() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPEnumeration e; ICPPBinding ei; @@ -9148,7 +9148,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testScopedEnums_305975d() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("fCol(Col::red)", 4); bh.assertProblem("fint(Col::red)", 4); @@ -9193,7 +9193,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testScopedEnums_305975f() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertProblem("high;", -1); bh.assertProblem("xdir d", -2); @@ -9306,7 +9306,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testNewCharacterTypes_305976() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction f1= bh.assertNonProblem("f(int)", 1); IFunction f2= bh.assertNonProblem("f(unsigned int)", 1); IBinding b= bh.assertNonProblem("f(c16)", 1); @@ -9345,7 +9345,7 @@ public class AST2CPPTests extends AST2TestBase { public void testBuiltinOperators_294543a() throws Exception { String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction fint= bh.assertNonProblem("f(int)", 1); IFunction f= bh.assertNonProblem("f(c+1)", 1); assertSame(fint, f); @@ -9363,7 +9363,7 @@ public class AST2CPPTests extends AST2TestBase { public void testBuiltinOperators_294543b() throws Exception { String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction fA= bh.assertNonProblem("f(A)", 1); IFunction f= bh.assertNonProblem("f(a= 1)", 1); assertSame(fA, f); @@ -9465,7 +9465,7 @@ public class AST2CPPTests extends AST2TestBase { assertFalse(f.isDefaulted()); assertTrue(f.isDeleted()); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPFunction fb= bh.assertNonProblem("X() =", 1); assertFalse(fb.isDeleted()); @@ -9557,7 +9557,7 @@ public class AST2CPPTests extends AST2TestBase { String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction fo= bh.assertNonProblem("f(int)", 1); IFunction g= bh.assertNonProblem("g(int)", 1); IFunction fi= bh.assertNonProblem("f(char)", 1); @@ -9578,7 +9578,7 @@ public class AST2CPPTests extends AST2TestBase { String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction f1= bh.assertNonProblem("f();", 1); IFunction f2= bh.assertNonProblem("f() {", 1); assertSame(f1, f2); @@ -9640,7 +9640,7 @@ public class AST2CPPTests extends AST2TestBase { // void g(MyType& val); public void testTypeString_323596() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction f= bh.assertNonProblem("f(", 1); assertEquals("const MyType &", ASTTypeUtil.getType(f.getType().getParameterTypes()[0], false)); assertEquals("const int &", ASTTypeUtil.getType(f.getType().getParameterTypes()[0], true)); @@ -9664,7 +9664,7 @@ public class AST2CPPTests extends AST2TestBase { // }; public void testConstMember_323599() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction f= bh.assertNonProblem("constBegin(); //ref", 10); bh.assertProblem("begin(); //ref", 5); } @@ -9684,7 +9684,7 @@ public class AST2CPPTests extends AST2TestBase { // }; public void testExplicitConversionOperators() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertProblem("fint(pe + pe);", 4); bh.assertNonProblem("fint(p + p);", 4); } @@ -9719,7 +9719,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testRankingOfDeprecatedConversionOnStringLiteral() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction g= bh.assertNonProblem("g(char *)", 1); IFunction fconst= bh.assertNonProblem("f(const char *)", 1); @@ -9847,7 +9847,7 @@ public class AST2CPPTests extends AST2TestBase { // S s3 = { }; // invoke #3 public void testEmptyInitializerList_324096() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction ctor1= bh.assertNonProblem("S(std::initializer_list);", 1); IFunction ctor2= bh.assertNonProblem("S(std::initializer_list);", 1); IFunction ctor3= bh.assertNonProblem("S();", 1); @@ -9926,7 +9926,7 @@ public class AST2CPPTests extends AST2TestBase { // C c5 {1,2}; // C(int, int) public void testCtorForAutomaticVariables_156668() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction ctor1= bh.assertNonProblem("C();", 1); IFunction ctor2= bh.assertNonProblem("C(int a, int b);", 1); @@ -9958,7 +9958,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testTopLevelRestrictQualifier_327328() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction g= bh.assertNonProblem("g(int * __restrict a)", 1); IFunction ref; ref= bh.assertNonProblem("g(int * a)", 1); @@ -9978,7 +9978,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testOverloadingWithRestrictQualifier_327328() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); IFunction f1= bh.assertNonProblem("f(int * __restrict* a)", 1); IFunction f2= bh.assertNonProblem("f(int ** a)", 1); IFunction ref; @@ -10059,7 +10059,7 @@ public class AST2CPPTests extends AST2TestBase { // auto f2 (); // missing late return type. public void testBug332114a() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); IBinding b= bh.assertNonProblem("f2", 0); // Must not throw a NPE IndexCPPSignatureUtil.getSignature(b); @@ -10519,7 +10519,7 @@ public class AST2CPPTests extends AST2TestBase { // g( nullptr ); // error // } public void testNullptr_327298b() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertProblem("checkNullPtr(1)", 12); bh.assertProblem("checklvalue(nullptr)", 11); bh.assertProblem("g( nullptr )", 1); @@ -10533,7 +10533,7 @@ public class AST2CPPTests extends AST2TestBase { // } public void testNullptr_327298c() throws Exception { parseAndCheckBindings(); - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); IFunction f= bh.assertNonProblem("f( nullptr )", 1); assertEquals("void (char *)", ASTTypeUtil.getType(f.getType())); f= bh.assertNonProblem("f( 0 )", 1); @@ -10542,7 +10542,7 @@ public class AST2CPPTests extends AST2TestBase { // void foo(struct S s); public void testParameterForwardDeclaration_379511() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType struct= bh.assertNonProblem("S", 1, ICPPClassType.class); IName[] declarations= bh.getTranslationUnit().getDeclarations(struct); assertEquals(1, declarations.length); @@ -10609,7 +10609,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true); + BindingAssertionHelper bindingHelper = new AST2AssertionHelper(code, true); CPPMethod functionDeclarationBinding = bindingHelper.assertNonProblem("mFuncDecl()", 9); assertFalse(functionDeclarationBinding.isOverride()); @@ -10639,7 +10639,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true); + BindingAssertionHelper bindingHelper = new AST2AssertionHelper(code, true); CPPMethod functionDeclarationBinding = bindingHelper.assertNonProblem("mFuncDecl() override", 9); assertTrue(functionDeclarationBinding.isOverride()); @@ -10669,7 +10669,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true); + BindingAssertionHelper bindingHelper = new AST2AssertionHelper(code, true); CPPMethod functionDeclarationBinding = bindingHelper.assertNonProblem("mFuncDecl() final", 9); assertTrue(functionDeclarationBinding.isOverride()); @@ -10700,7 +10700,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh = new BindingAssertionHelper(code, true); + BindingAssertionHelper bh = new AST2AssertionHelper(code, true); CPPClassType structBase = bh.assertNonProblem("Base {", 4); assertFalse(structBase.isFinal()); @@ -10731,7 +10731,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bindingHelper = new BindingAssertionHelper(code, true); + BindingAssertionHelper bindingHelper = new AST2AssertionHelper(code, true); ICPPMethod fooTemplate = bindingHelper.assertNonProblem("foo(T", 3); assertFalse(fooTemplate.isOverride()); @@ -11080,7 +11080,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh = new BindingAssertionHelper(code, true); + BindingAssertionHelper bh = new AST2AssertionHelper(code, true); ICPPClassType Enclosing = bh.assertNonProblem("Enclosing", 9); ICPPClassType Inner = bh.assertNonProblem("Inner", 5); @@ -11098,7 +11098,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh = new BindingAssertionHelper(code, true); + BindingAssertionHelper bh = new AST2AssertionHelper(code, true); ICPPClassType Enclosing = bh.assertNonProblem("Enclosing", 9); ICPPClassType Inner = bh.assertNonProblem("Inner;", 5); @@ -11113,7 +11113,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh = new BindingAssertionHelper(code, true); + BindingAssertionHelper bh = new AST2AssertionHelper(code, true); ICPPNamespace NamespaceNS = bh.assertNonProblem("NS {", 2); ICPPClassType Inner = bh.assertNonProblem("Inner", 5); @@ -11129,7 +11129,7 @@ public class AST2CPPTests extends AST2TestBase { String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh = new BindingAssertionHelper(code, true); + BindingAssertionHelper bh = new AST2AssertionHelper(code, true); ICPPNamespace NamespaceNS = bh.assertNonProblem("NS {", 2); ICPPClassType Inner = bh.assertNonProblem("Inner;", 5); @@ -12198,7 +12198,7 @@ public class AST2CPPTests extends AST2TestBase { // decltype(auto) l; // Error - missing initializer. public void testDecltypeAutoVariableTypes_482225() throws Exception { String code = getAboveComment(); - BindingAssertionHelper bh = new BindingAssertionHelper(code, true); + BindingAssertionHelper bh = new AST2AssertionHelper(code, true); ICPPVariable b = bh.assertNonProblem("b =", 1); assertEquals("A", ASTTypeUtil.getType(b.getType())); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java index de16fe4324f..89571f1c897 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CSpecTest.java @@ -331,7 +331,7 @@ public class AST2CSpecTest extends AST2SpecTestBase { // cond ? vp : ip; // } public void test6_5_15s8() throws Exception { - BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), ParserLanguage.C); + BindingAssertionHelper helper = new AST2AssertionHelper(getAboveComment(), ParserLanguage.C); IASTExpression c1 = helper.assertNode("cond ? c_vp : c_ip"); IASTExpression c2 = helper.assertNode("cond ? v_ip : 0"); IASTExpression c3 = helper.assertNode("cond ? c_ip : v_ip"); 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 45edc4edc2a..ebd82c2bff3 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 @@ -130,7 +130,7 @@ public class AST2TemplateTests extends AST2TestBase { protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException { String code= getAboveComment(); - return new BindingAssertionHelper(code, true); + return new AST2AssertionHelper(code, true); } private NameCollector getNameCollector(IASTTranslationUnit ast) { @@ -1344,7 +1344,7 @@ public class AST2TemplateTests extends AST2TestBase { // A ab; // A ac; public void testEnclosingScopes_a() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPSpecialization b0= ba.assertNonProblem("A", 4, ICPPSpecialization.class, ICPPClassType.class); ICPPTemplateInstance b1= ba.assertNonProblem("A", 4, ICPPTemplateInstance.class, ICPPClassType.class); @@ -1385,7 +1385,7 @@ public class AST2TemplateTests extends AST2TestBase { // A::B adb; // } public void testEnclosingScopes_b() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType b0= ba.assertNonProblem("B acb", 1, ICPPClassType.class); ICPPClassType b1= ba.assertNonProblem("B adb", 1, ICPPClassType.class, ICPPSpecialization.class); @@ -1412,7 +1412,7 @@ public class AST2TemplateTests extends AST2TestBase { // // X::Y::Z xayz; public void testEnclosingScopes_c() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType b0= ba.assertNonProblem("Y::Z x", 1, ICPPClassType.class); ICPPClassType b1= ba.assertNonProblem("Z xayz", 1, ICPPClassType.class); @@ -1436,7 +1436,7 @@ public class AST2TemplateTests extends AST2TestBase { // // X::N n; public void testEnclosingScopes_d() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType b0= ba.assertNonProblem("N n", 1, ICPPClassType.class); ICPPClassType b1= ba.assertNonProblem("N {", 1, ICPPClassType.class); @@ -2052,7 +2052,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // }; public void testBug201204() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction fn= bh.assertNonProblem("makeClosure(this", 11, ICPPFunction.class); } @@ -2078,7 +2078,7 @@ public class AST2TemplateTests extends AST2TestBase { // func(d, &C::m2); // } public void testBug233889() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction fn1= bh.assertNonProblem("func(c", 4, ICPPFunction.class); ICPPFunction fn2= bh.assertNonProblem("func(d", 4, ICPPFunction.class); assertNotSame(fn1, fn2); @@ -2101,7 +2101,7 @@ public class AST2TemplateTests extends AST2TestBase { // GetPair(x, 1); // } public void testBug229917a() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction fn = bh.assertNonProblem("GetPair(x", 7, ICPPFunction.class); } @@ -2118,7 +2118,7 @@ public class AST2TemplateTests extends AST2TestBase { // template // typename _C::value_type GetPair(_C& collection, typename _C::value_type::first_type key); public void testBug229917b() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); IBinding b0 = bh.assertNonProblem("value_type GetPair", 10, IBinding.class); } @@ -2137,7 +2137,7 @@ public class AST2TemplateTests extends AST2TestBase { // str.m(); // } public void testBug232086() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction b0 = bh.assertNonProblem("m();", 1, ICPPFunction.class); } @@ -2160,7 +2160,7 @@ public class AST2TemplateTests extends AST2TestBase { // bar(ca); // } public void testBug214646() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); IBinding b0= bh.assertNonProblem("foo(a)", 3); IBinding b1= bh.assertNonProblem("bar(ca)", 3); @@ -2192,7 +2192,7 @@ public class AST2TemplateTests extends AST2TestBase { // func(a2); // } public void testFunctionTemplate_245049a() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction b0= bh.assertNonProblem("func(a1)", 4, ICPPFunction.class); assertInstance(b0, ICPPTemplateInstance.class); ICPPFunction b1= bh.assertNonProblem("func(a2)", 4, ICPPFunction.class); @@ -2215,7 +2215,7 @@ public class AST2TemplateTests extends AST2TestBase { // func(a2); // } public void testFunctionTemplate_245049b() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction b0= bh.assertNonProblem("func(a1)", 4, ICPPFunction.class); assertInstance(b0, ICPPTemplateInstance.class); ICPPFunction b1= bh.assertNonProblem("func(a2)", 4, ICPPFunction.class); @@ -2238,7 +2238,7 @@ public class AST2TemplateTests extends AST2TestBase { // using ns::make_pair; // pair p = make_pair(1, 2); public void testFunctionTemplateWithUsing() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("make_pair(1", 9, ICPPFunction.class); } @@ -2285,7 +2285,7 @@ public class AST2TemplateTests extends AST2TestBase { // f(a(x)); // } public void testFunctionTemplate_264963() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("f(a(x));", 1, ICPPFunction.class); } @@ -2300,7 +2300,7 @@ public class AST2TemplateTests extends AST2TestBase { // f(&A::m); // } public void testFunctionTemplate_266532() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("f(&A::m);", 1, ICPPFunction.class); } @@ -2371,7 +2371,7 @@ public class AST2TemplateTests extends AST2TestBase { // f1(x, &f2); // } public void testFunctionTemplateWithFunctionPointer_281783() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("f1(x, &f2);", 2, ICPPFunction.class); } @@ -2793,7 +2793,7 @@ public class AST2TemplateTests extends AST2TestBase { // foo(d); // } public void testUserDefinedConversions_224364() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction fn= bh.assertNonProblem("foo(d)", 3, ICPPFunction.class); } @@ -2813,7 +2813,7 @@ public class AST2TemplateTests extends AST2TestBase { // foo(d); // } public void testUserDefinedConversions_224364a() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction fn= bh.assertNonProblem("foo(d)", 3, ICPPFunction.class); } @@ -2836,7 +2836,7 @@ public class AST2TemplateTests extends AST2TestBase { // // Z z= foo(*new E()); public void testUserDefinedConversions_224364b() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction fn= bh.assertNonProblem("foo(*new", 3, ICPPFunction.class); } @@ -2860,7 +2860,7 @@ public class AST2TemplateTests extends AST2TestBase { // foo(cx); // } public void testUserDefinedConversions_226231() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunction fn= bh.assertNonProblem("foo(cx", 3, ICPPFunction.class); } @@ -2879,7 +2879,7 @@ public class AST2TemplateTests extends AST2TestBase { // return foo(c); // } public void testUserDefinedConversions_239023() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ba.assertNonProblem("foo(c);", 3); } @@ -2980,7 +2980,7 @@ public class AST2TemplateTests extends AST2TestBase { // return at; // } public void testTypeIdAsTemplateArgumentIsTypeId_229942a() throws Exception { - BindingAssertionHelper ba=new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba=new AST2AssertionHelper(getAboveComment(), CPP); ba.assertNonProblem("T> at) {", 1); IASTTranslationUnit tu = parse(getAboveComment(), CPP, true, true); @@ -3045,7 +3045,7 @@ public class AST2TemplateTests extends AST2TestBase { // C c1; // C<> c2; // ok - default args public void testMissingTemplateArgumentLists() throws Exception { - BindingAssertionHelper ba=new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba=new AST2AssertionHelper(getAboveComment(), CPP); ba.assertProblem("B b1", 1); ba.assertNonProblem("B<> b2", 1, ICPPTemplateDefinition.class, ICPPClassType.class); ba.assertProblem("B<> b2", 3); @@ -3062,7 +3062,7 @@ public class AST2TemplateTests extends AST2TestBase { // member1 = 0; // } public void testDefinitionOfClassTemplateWithNonTypeParameter() throws Exception { - BindingAssertionHelper ba=new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba=new AST2AssertionHelper(getAboveComment(), CPP); ICPPMethod f1= ba.assertNonProblem("fun1(void);", 4, ICPPMethod.class); ICPPField m1= ba.assertNonProblem("member1;", 7, ICPPField.class); ICPPMethod f2= ba.assertNonProblem("fun1(void) {", 4, ICPPMethod.class); @@ -3088,7 +3088,7 @@ public class AST2TemplateTests extends AST2TestBase { // A::B<> b; // } public void testNestedTemplateDefinitionParameter() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPTemplateTypeParameter T3a= ba.assertNonProblem("T3 f", 2, ICPPTemplateTypeParameter.class); ICPPTemplateTypeParameter T3b= ba.assertNonProblem("T3)", 2, ICPPTemplateTypeParameter.class); ICPPClassType b= ba.assertNonProblem("B<>", 3, ICPPClassType.class, ICPPTemplateInstance.class); @@ -3104,7 +3104,7 @@ public class AST2TemplateTests extends AST2TestBase { // A::Y y; // A::Z z; public void testNonTypeArgumentDisambiguation_233460() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType b2= ba.assertNonProblem("A", 7, ICPPClassType.class, ICPPTemplateInstance.class); ICPPClassType b3= ba.assertNonProblem("A", 7, ICPPClassType.class, ICPPTemplateInstance.class); ICPPClassType b4= ba.assertNonProblem("A", 7, ICPPClassType.class, ICPPTemplateInstance.class); @@ -3133,7 +3133,7 @@ public class AST2TemplateTests extends AST2TestBase { // A::X x; //3 should be an error // A::Y y; //4 should be an error public void testNonTypeBooleanArgumentDisambiguation() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType X= ba.assertNonProblem("X x; //1", 1, ICPPClassType.class); ICPPClassType Y= ba.assertNonProblem("Y y; //2", 1, ICPPClassType.class); @@ -3164,7 +3164,7 @@ public class AST2TemplateTests extends AST2TestBase { // baz(); // } public void testBug207871() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPVariable _256= ba.assertNonProblem("_256=0x100", 4, ICPPVariable.class); IQualifierType qt1= assertInstance(_256.getType(), IQualifierType.class); @@ -3195,7 +3195,7 @@ public class AST2TemplateTests extends AST2TestBase { // C go(); // }; public void testDeferredNonTypeArgument() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPDeferredClassInstance ci= ba.assertNonProblem("C", 4, ICPPDeferredClassInstance.class); ICPPTemplateArgument[] args= ci.getTemplateArguments(); assertEquals(1, args.length); @@ -3207,7 +3207,7 @@ public class AST2TemplateTests extends AST2TestBase { // // A aint; // should be an error public void testTypeArgumentToNonTypeParameter() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ba.assertProblem("A", 6); } @@ -3227,7 +3227,7 @@ public class AST2TemplateTests extends AST2TestBase { // inline This::This() : That(I) { // } public void testParameterReferenceInChainInitializer_a() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); // These intermediate assertions will not hold until deferred non-type arguments are // correctly modelled @@ -3260,7 +3260,7 @@ public class AST2TemplateTests extends AST2TestBase { // inline This::This() : That() { // } public void testParameterReferenceInChainInitializer_b() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType tid= ba.assertNonProblem("This::T", 7, ICPPClassType.class); assertFalse(tid instanceof ICPPSpecialization); @@ -3282,7 +3282,7 @@ public class AST2TemplateTests extends AST2TestBase { // // C ca5L; public void testIntegralConversionInPartialSpecializationMatching_237914() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPTemplateInstance ctps= ba.assertNonProblem("C", 7, ICPPTemplateInstance.class, ICPPClassType.class); assertInstance(ctps.getTemplateDefinition(), ICPPClassTemplatePartialSpecialization.class); } @@ -3302,7 +3302,7 @@ public class AST2TemplateTests extends AST2TestBase { // ca5L.test= 0; // } public void testIntegralConversionInSpecializationMatching_237914() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPSpecialization ctps= ba.assertNonProblem("C", 7, ICPPSpecialization.class, ICPPClassType.class); ba.assertNonProblem("test=", 4, ICPPField.class); } @@ -3370,7 +3370,7 @@ public class AST2TemplateTests extends AST2TestBase { // B(const B& other) : A(other) {} // }; public void testChainInitializerLookupThroughDeferredClassBase() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ba.assertNonProblem("A(other", 1); } @@ -3403,7 +3403,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // }; public void testMemberLookupThroughDeferredClassBase() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ba.assertNonProblem("foo(s", 3); } @@ -3479,7 +3479,7 @@ public class AST2TemplateTests extends AST2TestBase { // return foo(); // } public void testMemberReferenceFromTemplatedMethodDefinition_238232() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ba.assertNonProblem("foo();", 3); } @@ -3524,7 +3524,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // detail public void testBug238180_ClassCast() throws Exception { // the code above used to trigger a ClassCastException - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPClassType p= ba.assertNonProblem("str", 0, ICPPClassType.class); ICPPConstructor con= p.getConstructors()[1]; ICPPReferenceType reftype= (ICPPReferenceType) con.getType().getParameterTypes()[0]; @@ -3552,7 +3552,7 @@ public class AST2TemplateTests extends AST2TestBase { // }; // template int CT::x = sizeof(T); public void testUsingTemplParamInInitializerOfStaticField() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPTemplateTypeParameter t= ba.assertNonProblem("T)", 1, ICPPTemplateTypeParameter.class); } @@ -3622,7 +3622,7 @@ public class AST2TemplateTests extends AST2TestBase { // func(cb); // } public void testTemplateMetaProgramming_245027() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ICPPMethod method= ba.assertNonProblem("method();", 6, ICPPMethod.class); ICPPVariable a= ba.assertNonProblem("a =", 1, ICPPVariable.class); ICPPVariable b= ba.assertNonProblem("b =", 1, ICPPVariable.class); @@ -3648,7 +3648,7 @@ public class AST2TemplateTests extends AST2TestBase { // ns1::A<(sizeof(probe(x)) == 1)>::m(x); // } public void testNonTypeTemplateParameter_252108() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), CPP); ba.assertNonProblem("x))", 1, ICPPVariable.class); } @@ -3740,7 +3740,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testFunctionSpecializationAsFriend() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPFunctionTemplate f= bh.assertNonProblem("f(T)", 1); IFunction fref1= bh.assertNonProblem("f<>", 1); assertSame(fref1, f); @@ -3767,7 +3767,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testMethodImplWithNonDeferredType() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPMethod m1= bh.assertNonProblem("m1();", 2); ICPPMethod m2= bh.assertNonProblem("m1() ", 2); assertSame(m1, m2); @@ -3792,7 +3792,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testClassTemplateMemberFunctionTemplate_104262() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPClassTemplate A1= bh.assertNonProblem("A1", 2); ICPPMethod method= bh.assertNonProblem("A1::f1", 13); @@ -3815,7 +3815,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testQualifiedMethodTemplate() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPMethod mt1= bh.assertNonProblem("m(V);", 1); ICPPMethod mt2= bh.assertNonProblem("m(V) ", 1); @@ -3887,7 +3887,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testFieldReference_257186() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); IBinding a1= bh.assertNonProblem("a;", 1); IBinding a2= bh.assertNonProblem("a=", 1); @@ -3909,7 +3909,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testUnknownReferences_257194() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("func();", 4, ICPPUnknownBinding.class); bh.assertNonProblem("var;", 3, ICPPUnknownBinding.class); @@ -3932,7 +3932,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testTypeOfUnknownReferences_257194a() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("b.c", 1, ICPPUnknownBinding.class); bh.assertNonProblem("c;", 1, ICPPUnknownBinding.class); @@ -3957,7 +3957,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testTypeOfUnknownReferences_257194b() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("b->c", 1, ICPPUnknownBinding.class); bh.assertNonProblem("c;", 1, ICPPUnknownBinding.class); @@ -3982,7 +3982,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testTypeVsExpressionInArgsOfDependentTemplateID_257194() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPUnknownBinding b= bh.assertNonProblem("a>", 1); assertFalse(b instanceof IType); @@ -4018,7 +4018,7 @@ public class AST2TemplateTests extends AST2TestBase { // func(p); // } public void testTypedefReference_259871() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("func(p)", 4, ICPPFunction.class); } @@ -4167,7 +4167,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // }; public void testNestedTemplates_259872a() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("A", 9, ICPPClassType.class); } @@ -4192,7 +4192,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // }; public void testNestedTemplates_259872b() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("A", 9, ICPPClassType.class); } @@ -4211,7 +4211,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testCtorWithTemplateID_259600() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPConstructor ctor= bh.assertNonProblem("DumbPtr/**/", 7); ICPPMethod dtor= bh.assertNonProblem("~DumbPtr/**/", 8); } @@ -4226,7 +4226,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testCtorTemplateWithTemplateID_259600() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPConstructor ctor= bh.assertNonProblem("XT/**/", 2); ctor= bh.assertNonProblem("XT/**/", 5); } @@ -4250,7 +4250,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testResolutionOfUnknownBindings_262163() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); IVariable x= bh.assertNonProblem("x;", 1); ITypedef Nested= bh.assertNonProblem("Nested;", 6); IType t= x.getType(); @@ -4282,7 +4282,7 @@ public class AST2TemplateTests extends AST2TestBase { // s.substr(0); // } public void testResolutionOfUnknownBindings_262328() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("substr(0)", 6, ICPPMethod.class); } @@ -4322,7 +4322,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testConflictInTemplateArgumentDeduction() throws Exception { final String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPMethod m= bh.assertNonProblem("append(3", 6); assertFalse(m instanceof ICPPTemplateInstance); } @@ -4341,7 +4341,7 @@ public class AST2TemplateTests extends AST2TestBase { // p.m(); // } public void testConversionSequence_263159() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPMethod m= bh.assertNonProblem("m();", 1, ICPPMethod.class); } @@ -4361,7 +4361,7 @@ public class AST2TemplateTests extends AST2TestBase { // return A(p); // } public void testForwardDeclarations_264109() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("A make_A(C* p) {", 4, ICPPTemplateInstance.class); parseAndCheckBindings(getAboveComment()); } @@ -4424,7 +4424,7 @@ public class AST2TemplateTests extends AST2TestBase { // getline2(i); // } public void testAmbiguousDeclaratorInFunctionTemplate_265342() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("getline2(i)", 8, ICPPTemplateInstance.class); parseAndCheckBindings(getAboveComment()); } @@ -4442,7 +4442,7 @@ public class AST2TemplateTests extends AST2TestBase { // }; // }; public void testOwnerOfFriendTemplate_265671() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); IFunction f= bh.assertNonProblem("f1(", 2, IFunction.class); IBinding owner= f.getOwner(); assertNull(owner); @@ -4487,7 +4487,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // template void g(T t) {} public void testDependentNameReferencingLaterDeclaration_265926a() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); IFunction gref= bh.assertNonProblem("g(t)", 1); assertInstance(gref, ICPPUnknownBinding.class); IFunction gdecl= bh.assertNonProblem("g(T t)", 1); @@ -4713,7 +4713,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testInlineFriendFunction_287409() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPFunction func= bh.assertNonProblem("f(x)", 1, ICPPFunction.class); assertFalse(func instanceof ICPPUnknownBinding); } @@ -4745,7 +4745,7 @@ public class AST2TemplateTests extends AST2TestBase { // }; public void testResolutionOfNonDependentNames_293052() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPFunction func= bh.assertNonProblem("m();", 1, ICPPFunction.class); assertFalse(func instanceof ICPPUnknownBinding); bh.assertProblem("n();", 1); @@ -4770,7 +4770,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testArgumentDeduction_293409() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("f1(d);", 2, ICPPFunction.class); bh.assertNonProblem("f2(&d);", 2, ICPPFunction.class); bh.assertNonProblem("f2(&cd);", 2, ICPPFunction.class); @@ -4931,7 +4931,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testRValueReferences_294730() throws Exception { final String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPClassType type= bh.assertNonProblem("X", 7); ICPPMethod[] ms= ClassTypeHelper.getMethods(type, null); @@ -4960,7 +4960,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testFunctionParameterPacks_280909() throws Exception { final String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPFunctionTemplate f= bh.assertNonProblem("f1", 2); assertEquals("void (int (*)(#0(...) ...))", ASTTypeUtil.getType(f.getType(), true)); assertFalse(f.getParameters()[0].isParameterPack()); @@ -4989,7 +4989,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testTemplateParameterPacks_280909() throws Exception { final String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPClassTemplate ct= bh.assertNonProblem("C1", 2); ICPPTemplateParameter tp= ct.getTemplateParameters()[0]; assertTrue(tp.isParameterPack()); @@ -5018,7 +5018,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testParameterPackExpansions_280909() throws Exception { final String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPField field= bh.assertNonProblem("a= 1", 1); field= bh.assertNonProblem("b= 1", 1); @@ -5034,7 +5034,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testTemplateParameterPacksAmbiguity_280909() throws Exception { final String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPFunctionTemplate ft= bh.assertNonProblem("f1", 2); ICPPTemplateParameter tp= ft.getTemplateParameters()[0]; assertTrue(tp.isParameterPack()); @@ -5094,7 +5094,7 @@ public class AST2TemplateTests extends AST2TestBase { // Tuple* u; // syntax error public void testVariadicTemplateExamples_280909e() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("String<>", 6); bh.assertProblem("String*", 6); bh.assertNonProblem("Tuple<>", 5); @@ -5114,7 +5114,7 @@ public class AST2TemplateTests extends AST2TestBase { // Y yc; // okay public void testVariadicTemplateExamples_280909f() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("X", 4); bh.assertProblem("X", 4); bh.assertProblem("X", 4); @@ -5137,7 +5137,7 @@ public class AST2TemplateTests extends AST2TestBase { // template void B::f4() {} // error public void testVariadicTemplateExamples_280909g() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("f1() {}", 2); bh.assertProblem("f2() {}", 2); bh.assertNonProblem("f3() {}", 2); @@ -5158,7 +5158,7 @@ public class AST2TemplateTests extends AST2TestBase { // } // int (*)(bool), Z is deduced to an empty sequence public void testVariadicTemplateExamples_280909h() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("f(5.6)", 6); bh.assertProblem("f(5.6)", 1); bh.assertNonProblem("f(f)", 7); @@ -5179,7 +5179,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testVariadicTemplateExamples_280909i() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("f", 0); bh.assertNonProblem("f", 0); bh.assertNonProblem("f", 0); @@ -5232,7 +5232,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testVariadicTemplateExamples_280909p() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("Tuple<>", 0); bh.assertNonProblem("Tuple", 0); bh.assertNonProblem("Tuple", 0); @@ -5279,7 +5279,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testVariadicTemplateExamples_280909s() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ITypedef td= bh.assertNonProblem("T1;", 2); IType type = getNestedType(td, TDEF); assertEquals("Tuple,Pair>", ASTTypeUtil.getType(type, false)); @@ -5346,7 +5346,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testDefaultTemplateArgsForFunctionTemplates_294730() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPTemplateInstance f= bh.assertNonProblem("f(1, 'c');", 1); assertEquals("", ASTTypeUtil.getArgumentListString(f.getTemplateArguments(), true)); @@ -5384,7 +5384,7 @@ public class AST2TemplateTests extends AST2TestBase { // eval> eE; // error: E does not match TT in partial specialization public void testExtendingVariadicTemplateTemplateParameters_302282() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPClassTemplate ct= bh.assertNonProblem("eval;", -1); ICPPClassTemplatePartialSpecialization pspec= bh.assertNonProblem("eval>", 0); @@ -5418,7 +5418,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testExplicitSpecializations_296427() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPTemplateInstance inst; inst= bh.assertNonProblem("X", 0); @@ -5457,7 +5457,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testBug306213a() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertNonProblem("func", 0); parseAndCheckBindings(code); } @@ -5474,7 +5474,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testBug306213b() throws Exception { CPPASTNameBase.sAllowRecursionBindings= true; final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); bh.assertProblem("func", 0); } @@ -5500,7 +5500,7 @@ public class AST2TemplateTests extends AST2TestBase { CPPASTNameBase.sAllowNameComputation= true; final String code= getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); final IASTTranslationUnit tu = bh.getTranslationUnit(); IBinding b= bh.assertNonProblem("CT {", 2); @@ -5572,7 +5572,7 @@ public class AST2TemplateTests extends AST2TestBase { public void testInlineNamespaces_305980() throws Exception { final String code = getAboveComment(); parseAndCheckBindings(code); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPFunctionTemplate ft= bh.assertNonProblem("f(T&)", 1); ICPPNamespace M= (ICPPNamespace) ft.getOwner(); @@ -5731,7 +5731,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testInstantiationOfFunctionTemplateWithOverloadedFunctionSetArgument_326492() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPFunctionTemplate f1= bh.assertNonProblem("f(T (*)(int), char)", 1); ICPPFunctionTemplate f2= bh.assertNonProblem("f(int (*)(T), int)", 1); IFunction g1= bh.assertNonProblem("g(char)", 1); @@ -5799,7 +5799,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testNestedTypedefSpecialization_329795() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(code, CPP); ICPPField f1= bh.assertNonProblem("foo;", 3); IBinding f2= bh.assertNonProblem("foo =", 3); assertSame(f1, f2); @@ -6171,7 +6171,7 @@ public class AST2TemplateTests extends AST2TestBase { // } public void testArgumentDeductionFromReturnTypeOfExplicitSpecialization_355304() throws Exception { parseAndCheckBindings(); - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPFunctionTemplate template= bh.assertNonProblem("f();", 1); ICPPTemplateInstance inst= bh.assertNonProblem("f() {", 1); assertSame(template, inst.getTemplateDefinition()); @@ -6363,7 +6363,7 @@ public class AST2TemplateTests extends AST2TestBase { // B::pointer a; public void testDependentExpressions_b() throws Exception { parseAndCheckBindings(); - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPVariable var= bh.assertNonProblem("a;", 1, ICPPVariable.class); IType type = var.getType(); type = SemanticUtil.getNestedType(type, TDEF); @@ -6508,7 +6508,7 @@ public class AST2TemplateTests extends AST2TestBase { // auto x1 = begin1(v); // auto x2 = begin2(v); public void testResolvingAutoTypeWithDependentExpression_402409a() throws Exception { - BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper helper = new AST2AssertionHelper(getAboveComment(), true); helper.assertVariableType("x1", CommonCPPTypes.pointerToInt); helper.assertVariableType("x2", CommonCPPTypes.pointerToInt); } @@ -6563,7 +6563,7 @@ public class AST2TemplateTests extends AST2TestBase { // }; public void testTemplateShortNameInQualifiedName_367607() throws Exception { parseAndCheckBindings(); - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); ICPPDeferredClassInstance shortHand= bh.assertNonProblem("derived:", -1); assertTrue(shortHand.getClassTemplate() instanceof ICPPClassTemplatePartialSpecialization); } @@ -6610,7 +6610,7 @@ public class AST2TemplateTests extends AST2TestBase { // e.x; // ERROR HERE: "Field 'x' could not be resolved" // } public void testAutoTypeWithTypedef_368311() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), CPP); IVariable v= bh.assertNonProblem("cur = r.begin()", 3); assertEquals("A::iterator_t", ASTTypeUtil.getType(v.getType(), true)); parseAndCheckBindings(); @@ -6930,7 +6930,7 @@ public class AST2TemplateTests extends AST2TestBase { // }; public void testNestedAliasDeclarationNestingLevel() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPAliasTemplate templateParameterAlias = bh.assertNonProblem("Alias=", "Alias", ICPPAliasTemplate.class); ICPPTemplateParameter aliasParameterT= templateParameterAlias.getTemplateParameters()[0]; @@ -6951,7 +6951,7 @@ public class AST2TemplateTests extends AST2TestBase { // }; public void testAliasDeclarationNestingLevel() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); ICPPAliasTemplate templateParameterAlias = bh.assertNonProblem("Alias=", "Alias", ICPPAliasTemplate.class); ICPPTemplateParameter aliasParameterT = templateParameterAlias.getTemplateParameters()[0]; @@ -7961,7 +7961,7 @@ public class AST2TemplateTests extends AST2TestBase { // // const bool B = has_type::value; public void testSfinaeInNestedTypeInTemplateArgument_402257() throws Exception { - BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper helper = new AST2AssertionHelper(getAboveComment(), true); ICPPVariable B = helper.assertNonProblem("B"); assertConstantValue(0 /* false */, B); } @@ -8784,7 +8784,7 @@ public class AST2TemplateTests extends AST2TestBase { // bind(s, 0, foo); // } public void testNPE_401140() throws Exception { - BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper helper = new AST2AssertionHelper(getAboveComment(), true); helper.assertProblem("bind(s, 0, foo)", "bind"); } @@ -8863,7 +8863,7 @@ public class AST2TemplateTests extends AST2TestBase { // }; // constexpr int bar = foo::i; public void testSizeofParameterPackOnTypeid_401973() throws Exception { - BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper helper = new AST2AssertionHelper(getAboveComment(), true); ICPPVariable bar = helper.assertNonProblem("bar"); assertConstantValue(2, bar); } @@ -9116,7 +9116,7 @@ public class AST2TemplateTests extends AST2TestBase { // auto x = foo(N::A()); // } public void testUnqualifiedFunctionCallInTemplate_402498b() throws Exception { - new BindingAssertionHelper(getAboveComment(), true).assertVariableType("x", CommonCPPTypes.int_); + new AST2AssertionHelper(getAboveComment(), true).assertVariableType("x", CommonCPPTypes.int_); } // template @@ -9132,7 +9132,7 @@ public class AST2TemplateTests extends AST2TestBase { // auto x = foo(N::A()); // } public void testUnqualifiedFunctionCallInTemplate_402498c() throws Exception { - BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper helper = new AST2AssertionHelper(getAboveComment(), true); ICPPVariable x = helper.assertNonProblem("x"); // We really should assert that x's type is a ProblemType, but the semantic // analyzer is too lenient and makes it a TypeOfDependentExpression if it @@ -9211,7 +9211,7 @@ public class AST2TemplateTests extends AST2TestBase { // A a; // auto b = foo(a); public void testQualifiedNameLookupInTemplate_402854() throws Exception { - BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper helper = new AST2AssertionHelper(getAboveComment(), true); helper.assertVariableType("b", CommonCPPTypes.int_); } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java index b69b38cefb9..90752755c58 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TestBase.java @@ -18,7 +18,6 @@ package org.eclipse.cdt.core.parser.tests.ast2; import static org.eclipse.cdt.core.parser.ParserLanguage.CPP; import java.io.IOException; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -41,14 +40,9 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement; import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; -import org.eclipse.cdt.core.dom.ast.IASTImplicitName; -import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; import org.eclipse.cdt.core.dom.ast.IASTInitializerClause; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IASTNodeSelector; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; @@ -86,19 +80,10 @@ import org.eclipse.cdt.core.parser.ParserMode; import org.eclipse.cdt.core.parser.ScannerInfo; import org.eclipse.cdt.core.parser.tests.ASTComparer; import org.eclipse.cdt.core.testplugin.CTestPlugin; -import org.eclipse.cdt.core.testplugin.util.BaseTestCase; import org.eclipse.cdt.core.testplugin.util.TestSourceReader; -import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser; -import org.eclipse.cdt.internal.core.dom.parser.c.CBasicType; -import org.eclipse.cdt.internal.core.dom.parser.c.CPointerType; -import org.eclipse.cdt.internal.core.dom.parser.c.CQualifierType; import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor; import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType; -import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType; import org.eclipse.cdt.internal.core.dom.parser.cpp.GNUCPPSourceParser; import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; import org.eclipse.cdt.internal.core.model.ASTStringUtil; @@ -110,60 +95,11 @@ import junit.framework.AssertionFailedError; /** * @author aniefer */ -public class AST2TestBase extends BaseTestCase { +public class AST2TestBase extends SemanticTestBase { public final static String TEST_CODE = ""; protected static final IParserLogService NULL_LOG = new NullLogService(); protected static boolean sValidateCopy; - protected static class CommonCTypes { - public static IType pointerToVoid = pointerTo(CBasicType.VOID); - public static IType pointerToConstVoid = pointerTo(constOf(CBasicType.VOID)); - public static IType pointerToConstInt = pointerTo(constOf(CBasicType.INT)); - public static IType pointerToVolatileInt = pointerTo(volatileOf(CBasicType.INT)); - public static IType pointerToConstVolatileInt = pointerTo(constVolatileOf(CBasicType.INT)); - - private static IType pointerTo(IType type) { - return new CPointerType(type, 0); - } - private static IType constOf(IType type) { - return new CQualifierType(type, true, false, false); - } - private static IType volatileOf(IType type) { - return new CQualifierType(type, false, true, false); - } - private static IType constVolatileOf(IType type) { - return new CQualifierType(type, true, true, false); - } - } - - protected static class CommonCPPTypes { - public static IType int_ = CPPBasicType.INT; - public static IType void_ = CPPBasicType.VOID; - public static IType constInt = constOf(int_); - public static IType pointerToInt = pointerTo(int_); - public static IType pointerToConstInt = pointerTo(constInt); - public static IType referenceToInt = referenceTo(int_); - public static IType referenceToConstInt = referenceTo(constInt); - public static IType rvalueReferenceToInt = rvalueReferenceTo(int_); - public static IType rvalueReferenceToConstInt = rvalueReferenceTo(constInt); - - private static IType pointerTo(IType type) { - return new CPPPointerType(type); - } - - private static IType constOf(IType type) { - return new CPPQualifierType(type, true, false); - } - - private static IType referenceTo(IType type) { - return new CPPReferenceType(type, false); - } - - private static IType rvalueReferenceTo(IType type) { - return new CPPReferenceType(type, true); - } - } - private static final ScannerInfo GNU_SCANNER_INFO = new ScannerInfo(getGnuMap()); private static final ScannerInfo SCANNER_INFO = new ScannerInfo(getStdMap()); @@ -405,14 +341,6 @@ public class AST2TestBase extends BaseTestCase { assertEquals(num, count); } - protected static void assertSameType(IType expected, IType actual) { - assertNotNull(expected); - assertNotNull(actual); - assertTrue("Expected same types, but the types were: '" + - ASTTypeUtil.getType(expected, false) + "' and '" + ASTTypeUtil.getType(actual, false) + "'", - expected.isSameType(actual)); - } - protected void isExpressionStringEqual(IASTInitializerClause exp, String str) { String expressionString = ASTStringUtil.getExpressionString((IASTExpression) exp); assertEquals(str, expressionString); @@ -544,294 +472,17 @@ public class AST2TestBase extends BaseTestCase { assertEquals(expected, numericalValue.longValue()); } - protected class BindingAssertionHelper { - protected IASTTranslationUnit tu; - protected String contents; + protected class AST2AssertionHelper extends BindingAssertionHelper { protected boolean isCPP; - public BindingAssertionHelper(String contents, boolean isCPP) throws ParserException { + public AST2AssertionHelper(String contents, boolean isCPP) throws ParserException { this(contents, isCPP ? ParserLanguage.CPP : ParserLanguage.C); } - public BindingAssertionHelper(String contents, ParserLanguage lang) throws ParserException { - this.contents= contents; + public AST2AssertionHelper(String contents, ParserLanguage lang) throws ParserException { + super(contents, parse(contents, lang, true, false)); this.isCPP= lang.isCPP(); - this.tu= parse(contents, lang, true, false); } - - public IASTTranslationUnit getTranslationUnit() { - return tu; - } - - public IProblemBinding assertProblem(String section, int len) { - if (len <= 0) - len= section.length() + len; - IBinding binding= binding(section, len); - assertTrue("Non-ProblemBinding for name: " + section.substring(0, len), - binding instanceof IProblemBinding); - return (IProblemBinding) binding; - } - - public IProblemBinding assertProblem(String context, int len, int problemId) { - IProblemBinding problemBinding = assertProblem(context, len); - assertEquals(problemId, problemBinding.getID()); - return problemBinding; - } - - public IProblemBinding assertProblem(String context, String name) { - IBinding binding= binding(context, name); - assertTrue("Non-ProblemBinding for name: " + name, binding instanceof IProblemBinding); - return (IProblemBinding) binding; - } - - public IProblemBinding assertProblem(String context, String name, int problemId) { - IProblemBinding problemBinding = assertProblem(context, name); - assertEquals(problemId, problemBinding.getID()); - return problemBinding; - } - - public T assertNonProblem(String section, int len) { - if (len <= 0) - len= section.length() + len; - IBinding binding= binding(section, len); - if (binding instanceof IProblemBinding) { - IProblemBinding problem= (IProblemBinding) binding; - fail("ProblemBinding for name: " + section.substring(0, len) + " (" + renderProblemID(problem.getID()) + ")"); - } - if (binding == null) { - fail("Null binding resolved for name: " + section.substring(0, len)); - } - return (T) binding; - } - - private int getIdentifierOffset(String str) { - for (int i = 0; i < str.length(); ++i) { - if (Character.isJavaIdentifierPart(str.charAt(i))) - return i; - } - fail("Didn't find identifier in \"" + str + "\""); - return -1; - } - - private int getIdentifierLength(String str, int offset) { - int i; - for (i = offset; i < str.length() && Character.isJavaIdentifierPart(str.charAt(i)); ++i) { - } - return i; - } - - public IProblemBinding assertProblemOnFirstIdentifier(String section) { - int offset = getIdentifierOffset(section); - String identifier = section.substring(offset, getIdentifierLength(section, offset)); - return assertProblem(section, identifier); - } - - public IProblemBinding assertProblemOnFirstIdentifier(String section, int problemId) { - IProblemBinding problemBinding = assertProblemOnFirstIdentifier(section); - assertEquals(problemId, problemBinding.getID()); - return problemBinding; - } - - public T assertNonProblemOnFirstIdentifier(String section, Class... cs) { - int offset = getIdentifierOffset(section); - String identifier = section.substring(offset, getIdentifierLength(section, offset)); - return assertNonProblem(section, identifier, cs); - } - - public void assertNoName(String section, int len) { - IASTName name= findName(section, len); - if (name != null) { - String selection = section.substring(0, len); - fail("Found unexpected \"" + selection + "\": " + name.resolveBinding()); - } - } - - /** - * Asserts that there is exactly one name at the given location and that - * it resolves to the given type of binding. - */ - public IASTImplicitName assertImplicitName(String section, int len, Class bindingClass) { - IASTName name = findImplicitName(section, len); - final String selection = section.substring(0, len); - assertNotNull("Did not find \"" + selection + "\"", name); - - assertInstance(name, IASTImplicitName.class); - IASTImplicitNameOwner owner = (IASTImplicitNameOwner) name.getParent(); - IASTImplicitName[] implicits = owner.getImplicitNames(); - assertNotNull(implicits); - - if (implicits.length > 1) { - boolean found = false; - for (IASTImplicitName n : implicits) { - if (((ASTNode) n).getOffset() == ((ASTNode) name).getOffset()) { - assertFalse(found); - found = true; - } - } - assertTrue(found); - } - - assertEquals(selection, name.getRawSignature()); - IBinding binding = name.resolveBinding(); - assertNotNull(binding); - assertInstance(binding, bindingClass); - return (IASTImplicitName) name; - } - - public void assertNoImplicitName(String section, int len) { - IASTName name = findImplicitName(section, len); - final String selection = section.substring(0, len); - assertNull("found name \"" + selection + "\"", name); - } - - public IASTImplicitName[] getImplicitNames(String section) { - return getImplicitNames(section, section.length()); - } - - public IASTImplicitName[] getImplicitNames(String section, int len) { - IASTName name = findImplicitName(section, len); - IASTImplicitNameOwner owner = (IASTImplicitNameOwner) name.getParent(); - IASTImplicitName[] implicits = owner.getImplicitNames(); - return implicits; - } - - public IASTImplicitDestructorName[] getImplicitDestructorNames(String section) { - return getImplicitDestructorNames(section, section.length()); - } - - public IASTImplicitDestructorName[] getImplicitDestructorNames(String section, int len) { - final int offset = contents.indexOf(section); - assertTrue(offset >= 0); - IASTNodeSelector selector = tu.getNodeSelector(null); - IASTNode enclosingNode = selector.findEnclosingNode(offset, len); - if (!(enclosingNode instanceof IASTImplicitDestructorNameOwner)) - return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; - return ((IASTImplicitDestructorNameOwner) enclosingNode).getImplicitDestructorNames(); - } - - public IASTName findName(String section, int len) { - final int offset = contents.indexOf(section); - assertTrue("Section \"" + section + "\" not found", offset >= 0); - IASTNodeSelector selector = tu.getNodeSelector(null); - return selector.findName(offset, len); - } - - public IASTName findName(String context, String name) { - if (context == null) { - context = contents; - } - int offset = contents.indexOf(context); - assertTrue("Context \"" + context + "\" not found", offset >= 0); - int nameOffset = context.indexOf(name); - assertTrue("Name \"" + name + "\" not found", nameOffset >= 0); - IASTNodeSelector selector = tu.getNodeSelector(null); - return selector.findName(offset + nameOffset, name.length()); - } - - public IASTName findName(String name) { - return findName(contents, name); - } - - public IASTImplicitName findImplicitName(String section, int len) { - final int offset = contents.indexOf(section); - assertTrue(offset >= 0); - IASTNodeSelector selector = tu.getNodeSelector(null); - return selector.findImplicitName(offset, len); - } - - public T assertNode(String context, String nodeText, Class... cs) { - if (context == null) { - context = contents; - } - int offset = contents.indexOf(context); - assertTrue("Context \"" + context + "\" not found", offset >= 0); - int nodeOffset = context.indexOf(nodeText); - assertTrue("Node \"" + nodeText + "\" not found", nodeOffset >= 0); - IASTNodeSelector selector = tu.getNodeSelector(null); - IASTNode node = selector.findNode(offset + nodeOffset, nodeText.length()); - return assertType(node, cs); - } - - public T assertNode(String nodeText, Class... cs) { - return assertNode(contents, nodeText, cs); - } - - private String renderProblemID(int i) { - try { - for (Field field : IProblemBinding.class.getDeclaredFields()) { - if (field.getName().startsWith("SEMANTIC_")) { - if (field.getType() == int.class) { - Integer ci= (Integer) field.get(null); - if (ci.intValue() == i) { - return field.getName(); - } - } - } - } - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - return "Unknown problem ID"; - } - - public T assertNonProblem(String section, int len, Class... cs) { - if (len <= 0) - len += section.length(); - IBinding binding= binding(section, len); - assertTrue("ProblemBinding for name: " + section.substring(0, len), - !(binding instanceof IProblemBinding)); - return assertType(binding, cs); - } - - public T assertNonProblem(String section, Class... cs) { - return assertNonProblem(section, section.length(), cs); - } - - public T assertNonProblem(String context, String name, Class... cs) { - IBinding binding= binding(context, name); - assertTrue("ProblemBinding for name: " + name, !(binding instanceof IProblemBinding)); - return assertType(binding, cs); - } - - public void assertVariableType(String variableName, IType expectedType) { - IVariable var = assertNonProblem(variableName); - assertSameType(expectedType, var.getType()); - } - - public void assertVariableValue(String variableName, long expectedValue) { - IVariable var = assertNonProblem(variableName); - BaseTestCase.assertVariableValue(var, expectedValue); - } - - public U assertType(T obj, Class... cs) { - for (Class c : cs) { - assertInstance(obj, c); - } - return (U) obj; - } - - private IBinding binding(String section, int len) { - IASTName astName = findName(section, len); - final String selection = section.substring(0, len); - assertNotNull("No AST name for \"" + selection + "\"", astName); - assertEquals(selection, astName.getRawSignature()); - - IBinding binding = astName.resolveBinding(); - assertNotNull("No binding for " + astName.getRawSignature(), binding); - - return astName.resolveBinding(); - } - - private IBinding binding(String context, String name) { - IASTName astName = findName(context, name); - assertNotNull("No AST name for \"" + name + "\"", astName); - assertEquals(name, astName.getRawSignature()); - - IBinding binding = astName.resolveBinding(); - assertNotNull("No binding for " + astName.getRawSignature(), binding); - - return astName.resolveBinding(); - } } final protected IASTTranslationUnit parseAndCheckBindings(String code, ParserLanguage lang) throws Exception { @@ -861,7 +512,7 @@ public class AST2TestBase extends BaseTestCase { protected BindingAssertionHelper getAssertionHelper(ParserLanguage lang) throws ParserException, IOException { String code= getAboveComment(); - return new BindingAssertionHelper(code, lang); + return new AST2AssertionHelper(code, lang); } final protected void assertNoProblemBindings(NameCollector col) { 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 3ab4872b0c8..10caf4e5477 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 @@ -2166,9 +2166,9 @@ public class AST2Tests extends AST2TestBase { // } public void testArrayPointer_261417() throws Exception { String code= getAboveComment(); - BindingAssertionHelper baC= new BindingAssertionHelper(code, false); + BindingAssertionHelper baC= new AST2AssertionHelper(code, false); baC.assertNonProblem("func(&a)", 4, IFunction.class); - BindingAssertionHelper baCpp= new BindingAssertionHelper(code, true); + BindingAssertionHelper baCpp= new AST2AssertionHelper(code, true); baCpp.assertNonProblem("func(&a)", 4, ICPPFunction.class); } @@ -3219,7 +3219,7 @@ public class AST2Tests extends AST2TestBase { // f1(__null); // } public void testBug240567() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), false); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), false); bh.assertNonProblem("f1(__null", 2, IFunction.class); } @@ -4162,7 +4162,7 @@ public class AST2Tests extends AST2TestBase { public void testBug100641_106279_castAmbiguity() throws Exception { boolean cpp= false; do { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), cpp); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), cpp); ba.assertNonProblem("field)", 5); ba.assertNonProblem("bit))", 3); ba.assertNonProblem("foux)", 4); @@ -4202,7 +4202,7 @@ public class AST2Tests extends AST2TestBase { // f4(cvi); // } public void testBug222418_a() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("f1(i)",2); ba.assertProblem("f1(ci)", 2); ba.assertProblem("f1(vi)", 2); @@ -4241,7 +4241,7 @@ public class AST2Tests extends AST2TestBase { // f1(cvi); // (4) // } public void testBug222418_b() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ICPPFunction f1_1= ba.assertNonProblem("f1(i)", 2, ICPPFunction.class); ICPPFunction f1_2= ba.assertNonProblem("f1(ci)", 2, ICPPFunction.class); @@ -4259,7 +4259,7 @@ public class AST2Tests extends AST2TestBase { // void f1(volatile int r) {} // 3 // void f1(const volatile int r) {} // 4 public void testBug222418_b_regression() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("f1(int", 2, ICPPFunction.class); ba.assertProblem("f1(const i", 2); ba.assertProblem("f1(vol", 2); @@ -4285,7 +4285,7 @@ public class AST2Tests extends AST2TestBase { // fd(five()); // should be an error // } public void testBug222418_c() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ICPPFunction fn= ba.assertNonProblem("five() {", 4, ICPPFunction.class); assertFalse(fn.getType().getReturnType() instanceof IProblemBinding); @@ -4317,7 +4317,7 @@ public class AST2Tests extends AST2TestBase { // f_nonconst(2); // should be an error // } public void testBug222418_d() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("f_const(2", 7, ICPPFunction.class); ba.assertProblem("f_nonconst(2", 10); } @@ -4356,7 +4356,7 @@ public class AST2Tests extends AST2TestBase { // f4(cvi); // } public void testBug222418_e() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("f1(i)",2); ba.assertProblem("f1(ci)", 2); ba.assertProblem("f1(vi)", 2); @@ -4431,7 +4431,7 @@ public class AST2Tests extends AST2TestBase { // return 0; // } public void testBug222418_f() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("foo1(a)", 4); ba.assertNonProblem("foo2(a)", 4); ba.assertNonProblem("foo1(3)", 4); @@ -4457,7 +4457,7 @@ public class AST2Tests extends AST2TestBase { // f(b2); // } public void testBug222418_g_regression() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("f(b2)", 1); } @@ -4468,7 +4468,7 @@ public class AST2Tests extends AST2TestBase { // f(r); // } public void testBug222418_h_regression() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("f(r)", 1); } @@ -4481,7 +4481,7 @@ public class AST2Tests extends AST2TestBase { // f(b2); // } public void testBug222418_i_regression() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("f(b2)", 1); } @@ -4520,7 +4520,7 @@ public class AST2Tests extends AST2TestBase { // return ri; // } public void testBug222418_j() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("fi(ri)", 2); ba.assertNonProblem("fp(&rwi)", 2); @@ -4559,7 +4559,7 @@ public class AST2Tests extends AST2TestBase { // a.foo(); // } public void testBug222418_k_regression() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ba.assertNonProblem("foo();", 3); } @@ -4580,7 +4580,7 @@ public class AST2Tests extends AST2TestBase { // foo(c); // } public void testBug222444_a() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ICPPFunction foo1= ba.assertNonProblem("foo(b", 3, ICPPFunction.class); ICPPFunction foo2= ba.assertNonProblem("foo(c", 3, ICPPFunction.class); } @@ -4601,7 +4601,7 @@ public class AST2Tests extends AST2TestBase { // foo(c); // } public void testBug222444_b() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ICPPFunction foo2= ba.assertNonProblem("foo(c", 3, ICPPFunction.class); } @@ -4621,7 +4621,7 @@ public class AST2Tests extends AST2TestBase { // foo(c); // } public void testBug222444_c() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ICPPFunction foo2= ba.assertNonProblem("foo(c", 3, ICPPFunction.class); } @@ -4826,7 +4826,7 @@ public class AST2Tests extends AST2TestBase { // } public void testBug228504_nonExistingMembers() throws Exception { for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), lang); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), lang); for (int i= 1; i < 5; i++) { ba.assertNonProblem("foo=" + i, 3); ba.assertProblem("bar=" + i, 3); @@ -4872,7 +4872,7 @@ public class AST2Tests extends AST2TestBase { public void testOutOfOrderResolution_232300() throws Exception { String code= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang); IBinding b1= ba.assertNonProblem("function1(); // decl", 9); IBinding b2= ba.assertNonProblem("function1() {", 9); IBinding b3= ba.assertNonProblem("function1(); // ref", 9); @@ -4886,7 +4886,7 @@ public class AST2Tests extends AST2TestBase { public void testRedefinePtrdiff_230895() throws Exception { String code= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang); IBinding b1= ba.assertNonProblem("ptrdiff_t", 9); assertInstance(b1, ITypedef.class); ITypedef td= (ITypedef) b1; @@ -4902,7 +4902,7 @@ public class AST2Tests extends AST2TestBase { public void testRedefineStructInScopeThatIsFullyResolved() throws Exception { String code= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang); ba.assertNonProblem("a; // ref", 1); // now scope is fully resolved ICompositeType ct= ba.assertNonProblem("S;", 1, ICompositeType.class); @@ -4929,7 +4929,7 @@ public class AST2Tests extends AST2TestBase { public void testTypedefVoid_221567() throws Exception { String code= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang); ITypedef td= ba.assertNonProblem("VOID;", 4, ITypedef.class); IFunction func= ba.assertNonProblem("func", 4, IFunction.class); @@ -4969,7 +4969,7 @@ public class AST2Tests extends AST2TestBase { public void testParamWithFunctionType_84242() throws Exception { final String comment= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(comment, lang); IFunction f= ba.assertNonProblem("f1", 2, IFunction.class); isTypeEqual(f.getType(), "int (int (*)(int))"); @@ -4991,7 +4991,7 @@ public class AST2Tests extends AST2TestBase { // class C { }; // void f1(int(C)) { } public void testParamWithFunctionTypeCpp_84242() throws Exception { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); IFunction f= ba.assertNonProblem("f1", 2, IFunction.class); isTypeEqual(f.getType(), "void (int (*)(C))"); @@ -5002,7 +5002,7 @@ public class AST2Tests extends AST2TestBase { public void testFunctionReturningPtrToArray_216609() throws Exception { final String comment= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), lang); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), lang); IFunction f= ba.assertNonProblem("f1", 2, IFunction.class); isTypeEqual(f.getType(), "int (* (int))[5]"); @@ -5078,7 +5078,7 @@ public class AST2Tests extends AST2TestBase { final String comment= getAboveComment(); final boolean[] isCpps= {false, true}; for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(comment, lang); ba.assertNonProblem("b; a", 1, IVariable.class); // fill cache of inner block IVariable v3= ba.assertNonProblem("a; }", 1, IVariable.class); @@ -5093,7 +5093,7 @@ public class AST2Tests extends AST2TestBase { public void testComplexParameterBinding_214482() throws Exception { final String comment= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(comment, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(comment, lang); IParameter p= ba.assertNonProblem("ptr", 3, IParameter.class); assertEquals("ptr", p.getName()); } @@ -5472,7 +5472,7 @@ public class AST2Tests extends AST2TestBase { public void testAnonymousUnionMember() throws Exception { final boolean[] isCpps= {false, true}; for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), lang); + BindingAssertionHelper bh= new AST2AssertionHelper(getAboveComment(), lang); bh.assertNonProblem("a1=", 2); bh.assertProblem("a2=", 2); bh.assertNonProblem("a3=", 2); @@ -5747,7 +5747,7 @@ public class AST2Tests extends AST2TestBase { public void testValues() throws Exception { final String code= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper bh= new BindingAssertionHelper(code, lang); + BindingAssertionHelper bh= new AST2AssertionHelper(code, lang); IVariable v= (IVariable) bh.assertNonProblem("a=", 1); checkValue(v.getInitialValue(), -4); v= (IVariable) bh.assertNonProblem("b=", 1); @@ -6071,7 +6071,7 @@ public class AST2Tests extends AST2TestBase { public void testAmbiguousDeclaration_259373() throws Exception { final String code= getAboveComment(); IASTTranslationUnit tu= parseAndCheckBindings(code, C, true); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); ITypedef td= bh.assertNonProblem("TInt; //", 4); IField f= bh.assertNonProblem("a;", 1); } @@ -6105,7 +6105,7 @@ public class AST2Tests extends AST2TestBase { for (ParserLanguage lang : ParserLanguage.values()) { IASTTranslationUnit tu= parseAndCheckBindings(code, lang, true); - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang == CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang == CPP); ITypedef t= ba.assertNonProblem("A;", 1); ICompositeType s1= ba.assertNonProblem("A; // struct", 1); ICompositeType s2= ba.assertNonProblem("A*", 1); @@ -6123,7 +6123,7 @@ public class AST2Tests extends AST2TestBase { public void testTypeOfExpressionWithTypedef_380498_1() throws Exception { String code= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang); IASTExpression exp = ba.assertNode("a + 5", IASTExpression.class); assertTrue(exp.getExpressionType() instanceof ITypedef); assertEquals("size_t", ((ITypedef) exp.getExpressionType()).getName()); @@ -6145,7 +6145,7 @@ public class AST2Tests extends AST2TestBase { public void testTypeOfExpressionWithTypedef_380498_2() throws Exception { String code= getAboveComment(); for (ParserLanguage lang: ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang); IASTExpression exp = ba.assertNode("f()", IASTExpression.class); assertTrue(exp.getExpressionType() instanceof ITypedef); assertEquals("VoidPtr", ((ITypedef) exp.getExpressionType()).getName()); @@ -6155,10 +6155,10 @@ public class AST2Tests extends AST2TestBase { // int a= TInt; //ref public void testTypeAsExpressionIsProblem_261175() throws Exception { final String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertProblem("TInt; //ref", 4); - bh= new BindingAssertionHelper(code, false); + bh= new AST2AssertionHelper(code, false); bh.assertProblem("TInt; //ref", 4); } @@ -6170,7 +6170,7 @@ public class AST2Tests extends AST2TestBase { public void testSizeofFunctionType_252243() throws Exception { final String code= getAboveComment(); for (ParserLanguage lang : ParserLanguage.values()) { - BindingAssertionHelper ba= new BindingAssertionHelper(code, lang == CPP); + BindingAssertionHelper ba= new AST2AssertionHelper(code, lang == CPP); ba.assertProblem("y));", 1); IVariable v= ba.assertNonProblem("y);", 1); } @@ -7143,7 +7143,7 @@ public class AST2Tests extends AST2TestBase { // void f2(const int* p) {} public void testDroppingOfStorageDecl_293322() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); IFunction f= bh.assertNonProblem("f1", 2); assertEquals("const int *", ASTTypeUtil.getType(f.getParameters()[0].getType())); f= bh.assertNonProblem("f2", 2); @@ -7211,7 +7211,7 @@ public class AST2Tests extends AST2TestBase { // typeof(b(1)) b(int); public void testRecursiveFunctionType_321856() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); IFunction f= bh.assertNonProblem("b(1)", 1); f= bh.assertNonProblem("b(int)", 1); f.getType(); @@ -7255,10 +7255,10 @@ public class AST2Tests extends AST2TestBase { // } public void testParameterRedeclaration_301779() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("obj", 3, IParameter.class); bh.assertProblem("obj =", 3); - bh= new BindingAssertionHelper(code, false); + bh= new AST2AssertionHelper(code, false); bh.assertNonProblem("obj", 3, IParameter.class); bh.assertProblem("obj =", 3); } @@ -7332,12 +7332,12 @@ public class AST2Tests extends AST2TestBase { // } public void testLocalVariableOfTypeVaList_313270() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); IBinding var= bh.assertNonProblem("result", 0); assertInstance(var, IVariable.class); assertTrue(var.getScope().getKind() == EScopeKind.eLocal); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); var= bh.assertNonProblem("result", 0); assertInstance(var, IVariable.class); assertTrue(var.getScope().getKind() == EScopeKind.eLocal); @@ -7349,7 +7349,7 @@ public class AST2Tests extends AST2TestBase { String code= getAboveComment(); parseAndCheckBindings(code); for (ParserLanguage lang : ParserLanguage.values()) { - BindingAssertionHelper bh= new BindingAssertionHelper(code, lang); + BindingAssertionHelper bh= new AST2AssertionHelper(code, lang); IParameter i= bh.assertNonProblem("i)", 1); IParameter j= bh.assertNonProblem("j)", 1); assertSame(i, j); @@ -7368,7 +7368,7 @@ public class AST2Tests extends AST2TestBase { final String comment = getAboveComment(); String code= comment; parseAndCheckBindings(code, C, true); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); ITypedef td= bh.assertNonProblem("ptrdiff_t", 0); assertEquals("long int", ASTTypeUtil.getType(td.getType())); td= bh.assertNonProblem("size_t", 0); @@ -7376,7 +7376,7 @@ public class AST2Tests extends AST2TestBase { code= "namespace std {" + comment + "}"; parseAndCheckBindings(code, CPP, true); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); td= bh.assertNonProblem("ptrdiff_t", 0); assertEquals("long int", ASTTypeUtil.getType(td.getType())); td= bh.assertNonProblem("size_t", 0); @@ -7390,12 +7390,12 @@ public class AST2Tests extends AST2TestBase { public void testParameterResolution() throws Exception { final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, true); + BindingAssertionHelper bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("f(int a)", 1); bh.assertNonProblem("f(int)", 1); bh.assertNonProblem("a;", 1); - bh= new BindingAssertionHelper(code, false); + bh= new AST2AssertionHelper(code, false); bh.assertNonProblem("f(int a)", 1); bh.assertNonProblem("f(int)", 1); bh.assertNonProblem("a;", 1); @@ -7541,7 +7541,7 @@ public class AST2Tests extends AST2TestBase { + "#define STRINGIFY(x) STRINGIFY_(x)\r\n" + "template void f(const char (&)[N]);\r\n" + "int main() { f(STRINGIFY(MACRO)); }\r\n"; - BindingAssertionHelper helper = new BindingAssertionHelper(code, true); + BindingAssertionHelper helper = new AST2AssertionHelper(code, true); ICPPTemplateInstance f = helper.assertNonProblem("f(STRINGIFY", "f"); // 7 characters for "foobar" + the null terminator. assertEquals(7, f.getTemplateArguments()[0].getNonTypeValue().numberValue().longValue()); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTInactiveCodeTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTInactiveCodeTests.java index da950f497e9..ef7dfbff97c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTInactiveCodeTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTInactiveCodeTests.java @@ -277,14 +277,14 @@ public class ASTInactiveCodeTests extends AST2TestBase { // int b; // 2 public void testDuplicateDefinition() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); bh.assertNonProblem("a; // 1", 1); bh.assertNonProblem("a; // 2", 1); bh.assertNonProblem("a; // 3", 1); bh.assertNonProblem("b; // 1", 1); bh.assertNonProblem("b; // 2", 1); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); bh.assertNonProblem("a; // 1", 1); bh.assertNonProblem("a; // 2", 1); bh.assertNonProblem("a; // 3", 1); @@ -305,12 +305,12 @@ public class ASTInactiveCodeTests extends AST2TestBase { // #endif public void testInactiveClosingBrace() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); IField a= bh.assertNonProblem("a;", 1); IField b= bh.assertNonProblem("b;", 1); assertSame(a.getOwner(), b.getOwner()); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); a= bh.assertNonProblem("a;", 1); b= bh.assertNonProblem("b;", 1); assertSame(a.getOwner(), b.getOwner()); @@ -330,7 +330,7 @@ public class ASTInactiveCodeTests extends AST2TestBase { // }; public void testOpenBraceInActiveBranch() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); IField a= bh.assertNonProblem("a;", 1); bh.assertNoName("b;", 1); IField c= bh.assertNonProblem("c;", 1); @@ -338,7 +338,7 @@ public class ASTInactiveCodeTests extends AST2TestBase { assertSame(a.getOwner(), c.getOwner()); assertSame(a.getOwner(), d.getOwner()); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); a= bh.assertNonProblem("a;", 1); bh.assertNoName("b;", 1); c= bh.assertNonProblem("c;", 1); @@ -360,7 +360,7 @@ public class ASTInactiveCodeTests extends AST2TestBase { // int d; public void testOpenBraceInInactiveBranch() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); IField a= bh.assertNonProblem("a;", 1); IField b= bh.assertNonProblem("b;", 1); IVariable c= bh.assertNonProblem("c;", 1); // part of a different non-nested branch @@ -369,7 +369,7 @@ public class ASTInactiveCodeTests extends AST2TestBase { assertNull(c.getOwner()); assertNull(d.getOwner()); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); a= bh.assertNonProblem("a;", 1); b= bh.assertNonProblem("b;", 1); c= bh.assertNonProblem("c;", 1); // part of a different non-nested branch @@ -390,12 +390,12 @@ public class ASTInactiveCodeTests extends AST2TestBase { // #endif public void testUnexpectedBranchesInInactiveCode() throws Exception { String code= getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, false); + BindingAssertionHelper bh= new AST2AssertionHelper(code, false); IFunction f= bh.assertNonProblem("f()", 1); bh.assertNoName("a;", 1); bh.assertNoName("b;", 1); - bh= new BindingAssertionHelper(code, true); + bh= new AST2AssertionHelper(code, true); f= bh.assertNonProblem("f()", 1); bh.assertNoName("a;", 1); bh.assertNoName("b;", 1); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AccessControlTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AccessControlTests.java index c2854bcee32..9d0355a3c64 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AccessControlTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AccessControlTests.java @@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.core.parser.ParserException; public class AccessControlTests extends AST2TestBase { - protected class AccessAssertionHelper extends BindingAssertionHelper { + protected class AccessAssertionHelper extends AST2AssertionHelper { AccessAssertionHelper(String contents) throws ParserException { super(contents, true); } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java new file mode 100644 index 00000000000..c7fc2da1d65 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticTestBase.java @@ -0,0 +1,386 @@ +/******************************************************************************* + * 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 java.lang.reflect.Field; + +import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; +import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorName; +import org.eclipse.cdt.core.dom.ast.IASTImplicitDestructorNameOwner; +import org.eclipse.cdt.core.dom.ast.IASTImplicitName; +import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTNodeSelector; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.IProblemBinding; +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.IVariable; +import org.eclipse.cdt.core.testplugin.util.BaseTestCase; +import org.eclipse.cdt.internal.core.dom.parser.ASTNode; +import org.eclipse.cdt.internal.core.dom.parser.c.CBasicType; +import org.eclipse.cdt.internal.core.dom.parser.c.CPointerType; +import org.eclipse.cdt.internal.core.dom.parser.c.CQualifierType; +import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType; +import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType; +import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPQualifierType; +import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPReferenceType; + +/** + * Common base class for AST2 and index tests. + */ +public class SemanticTestBase extends BaseTestCase { + public SemanticTestBase() { + super(); + } + public SemanticTestBase(String name) { + super(name); + } + + protected static class CommonCTypes { + public static IType pointerToVoid = pointerTo(CBasicType.VOID); + public static IType pointerToConstVoid = pointerTo(constOf(CBasicType.VOID)); + public static IType pointerToConstInt = pointerTo(constOf(CBasicType.INT)); + public static IType pointerToVolatileInt = pointerTo(volatileOf(CBasicType.INT)); + public static IType pointerToConstVolatileInt = pointerTo(constVolatileOf(CBasicType.INT)); + + private static IType pointerTo(IType type) { + return new CPointerType(type, 0); + } + private static IType constOf(IType type) { + return new CQualifierType(type, true, false, false); + } + private static IType volatileOf(IType type) { + return new CQualifierType(type, false, true, false); + } + private static IType constVolatileOf(IType type) { + return new CQualifierType(type, true, true, false); + } + } + + protected static class CommonCPPTypes { + public static IType int_ = CPPBasicType.INT; + public static IType void_ = CPPBasicType.VOID; + public static IType constInt = constOf(int_); + public static IType pointerToInt = pointerTo(int_); + public static IType pointerToConstInt = pointerTo(constInt); + public static IType referenceToInt = referenceTo(int_); + public static IType referenceToConstInt = referenceTo(constInt); + public static IType rvalueReferenceToInt = rvalueReferenceTo(int_); + public static IType rvalueReferenceToConstInt = rvalueReferenceTo(constInt); + + private static IType pointerTo(IType type) { + return new CPPPointerType(type); + } + + private static IType constOf(IType type) { + return new CPPQualifierType(type, true, false); + } + + private static IType referenceTo(IType type) { + return new CPPReferenceType(type, false); + } + + private static IType rvalueReferenceTo(IType type) { + return new CPPReferenceType(type, true); + } + } + + protected static void assertSameType(IType expected, IType actual) { + assertNotNull(expected); + assertNotNull(actual); + assertTrue("Expected same types, but the types were: '" + + ASTTypeUtil.getType(expected, false) + "' and '" + ASTTypeUtil.getType(actual, false) + "'", + expected.isSameType(actual)); + } + + protected class BindingAssertionHelper { + protected String contents; + protected IASTTranslationUnit tu; + + public BindingAssertionHelper(String contents, IASTTranslationUnit tu) { + this.contents = contents; + this.tu = tu; + } + + public IASTTranslationUnit getTranslationUnit() { + return tu; + } + + public IProblemBinding assertProblem(String section, int len) { + if (len <= 0) + len= section.length() + len; + IBinding binding= binding(section, len); + assertTrue("Non-ProblemBinding for name: " + section.substring(0, len), + binding instanceof IProblemBinding); + return (IProblemBinding) binding; + } + + public IProblemBinding assertProblem(String context, int len, int problemId) { + IProblemBinding problemBinding = assertProblem(context, len); + assertEquals(problemId, problemBinding.getID()); + return problemBinding; + } + + public IProblemBinding assertProblem(String context, String name) { + IBinding binding= binding(context, name); + assertTrue("Non-ProblemBinding for name: " + name, binding instanceof IProblemBinding); + return (IProblemBinding) binding; + } + + public IProblemBinding assertProblem(String context, String name, int problemId) { + IProblemBinding problemBinding = assertProblem(context, name); + assertEquals(problemId, problemBinding.getID()); + return problemBinding; + } + + public T assertNonProblem(String section, int len) { + if (len <= 0) + len= section.length() + len; + IBinding binding= binding(section, len); + if (binding instanceof IProblemBinding) { + IProblemBinding problem= (IProblemBinding) binding; + fail("ProblemBinding for name: " + section.substring(0, len) + " (" + renderProblemID(problem.getID()) + ")"); + } + if (binding == null) { + fail("Null binding resolved for name: " + section.substring(0, len)); + } + return (T) binding; + } + + private int getIdentifierOffset(String str) { + for (int i = 0; i < str.length(); ++i) { + if (Character.isJavaIdentifierPart(str.charAt(i))) + return i; + } + fail("Didn't find identifier in \"" + str + "\""); + return -1; + } + + private int getIdentifierLength(String str, int offset) { + int i; + for (i = offset; i < str.length() && Character.isJavaIdentifierPart(str.charAt(i)); ++i) { + } + return i; + } + + public IProblemBinding assertProblemOnFirstIdentifier(String section) { + int offset = getIdentifierOffset(section); + String identifier = section.substring(offset, getIdentifierLength(section, offset)); + return assertProblem(section, identifier); + } + + public IProblemBinding assertProblemOnFirstIdentifier(String section, int problemId) { + IProblemBinding problemBinding = assertProblemOnFirstIdentifier(section); + assertEquals(problemId, problemBinding.getID()); + return problemBinding; + } + + public T assertNonProblemOnFirstIdentifier(String section, Class... cs) { + int offset = getIdentifierOffset(section); + String identifier = section.substring(offset, getIdentifierLength(section, offset)); + return assertNonProblem(section, identifier, cs); + } + + public void assertNoName(String section, int len) { + IASTName name= findName(section, len); + if (name != null) { + String selection = section.substring(0, len); + fail("Found unexpected \"" + selection + "\": " + name.resolveBinding()); + } + } + + /** + * Asserts that there is exactly one name at the given location and that + * it resolves to the given type of binding. + */ + public IASTImplicitName assertImplicitName(String section, int len, Class bindingClass) { + IASTName name = findImplicitName(section, len); + final String selection = section.substring(0, len); + assertNotNull("Did not find \"" + selection + "\"", name); + + assertInstance(name, IASTImplicitName.class); + IASTImplicitNameOwner owner = (IASTImplicitNameOwner) name.getParent(); + IASTImplicitName[] implicits = owner.getImplicitNames(); + assertNotNull(implicits); + + if (implicits.length > 1) { + boolean found = false; + for (IASTImplicitName n : implicits) { + if (((ASTNode) n).getOffset() == ((ASTNode) name).getOffset()) { + assertFalse(found); + found = true; + } + } + assertTrue(found); + } + + assertEquals(selection, name.getRawSignature()); + IBinding binding = name.resolveBinding(); + assertNotNull(binding); + assertInstance(binding, bindingClass); + return (IASTImplicitName) name; + } + + public void assertNoImplicitName(String section, int len) { + IASTName name = findImplicitName(section, len); + final String selection = section.substring(0, len); + assertNull("found name \"" + selection + "\"", name); + } + + public IASTImplicitName[] getImplicitNames(String section) { + return getImplicitNames(section, section.length()); + } + + public IASTImplicitName[] getImplicitNames(String section, int len) { + IASTName name = findImplicitName(section, len); + IASTImplicitNameOwner owner = (IASTImplicitNameOwner) name.getParent(); + IASTImplicitName[] implicits = owner.getImplicitNames(); + return implicits; + } + + public IASTImplicitDestructorName[] getImplicitDestructorNames(String section) { + return getImplicitDestructorNames(section, section.length()); + } + + public IASTImplicitDestructorName[] getImplicitDestructorNames(String section, int len) { + final int offset = contents.indexOf(section); + assertTrue(offset >= 0); + IASTNodeSelector selector = tu.getNodeSelector(null); + IASTNode enclosingNode = selector.findEnclosingNode(offset, len); + if (!(enclosingNode instanceof IASTImplicitDestructorNameOwner)) + return IASTImplicitDestructorName.EMPTY_NAME_ARRAY; + return ((IASTImplicitDestructorNameOwner) enclosingNode).getImplicitDestructorNames(); + } + + public IASTName findName(String section, int len) { + final int offset = contents.indexOf(section); + assertTrue("Section \"" + section + "\" not found", offset >= 0); + IASTNodeSelector selector = tu.getNodeSelector(null); + return selector.findName(offset, len); + } + + public IASTName findName(String context, String name) { + if (context == null) { + context = contents; + } + int offset = contents.indexOf(context); + assertTrue("Context \"" + context + "\" not found", offset >= 0); + int nameOffset = context.indexOf(name); + assertTrue("Name \"" + name + "\" not found", nameOffset >= 0); + IASTNodeSelector selector = tu.getNodeSelector(null); + return selector.findName(offset + nameOffset, name.length()); + } + + public IASTName findName(String name) { + return findName(contents, name); + } + + public IASTImplicitName findImplicitName(String section, int len) { + final int offset = contents.indexOf(section); + assertTrue(offset >= 0); + IASTNodeSelector selector = tu.getNodeSelector(null); + return selector.findImplicitName(offset, len); + } + + public T assertNode(String context, String nodeText, Class... cs) { + if (context == null) { + context = contents; + } + int offset = contents.indexOf(context); + assertTrue("Context \"" + context + "\" not found", offset >= 0); + int nodeOffset = context.indexOf(nodeText); + assertTrue("Node \"" + nodeText + "\" not found", nodeOffset >= 0); + IASTNodeSelector selector = tu.getNodeSelector(null); + IASTNode node = selector.findNode(offset + nodeOffset, nodeText.length()); + return assertType(node, cs); + } + + public T assertNode(String nodeText, Class... cs) { + return assertNode(contents, nodeText, cs); + } + + private String renderProblemID(int i) { + try { + for (Field field : IProblemBinding.class.getDeclaredFields()) { + if (field.getName().startsWith("SEMANTIC_")) { + if (field.getType() == int.class) { + Integer ci= (Integer) field.get(null); + if (ci.intValue() == i) { + return field.getName(); + } + } + } + } + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + return "Unknown problem ID"; + } + + public T assertNonProblem(String section, int len, Class... cs) { + if (len <= 0) + len += section.length(); + IBinding binding= binding(section, len); + assertTrue("ProblemBinding for name: " + section.substring(0, len), + !(binding instanceof IProblemBinding)); + return assertType(binding, cs); + } + + public T assertNonProblem(String section, Class... cs) { + return assertNonProblem(section, section.length(), cs); + } + + public T assertNonProblem(String context, String name, Class... cs) { + IBinding binding= binding(context, name); + assertTrue("ProblemBinding for name: " + name, !(binding instanceof IProblemBinding)); + return assertType(binding, cs); + } + + public void assertVariableType(String variableName, IType expectedType) { + IVariable var = assertNonProblem(variableName); + assertSameType(expectedType, var.getType()); + } + + public void assertVariableValue(String variableName, long expectedValue) { + IVariable var = assertNonProblem(variableName); + BaseTestCase.assertVariableValue(var, expectedValue); + } + + public U assertType(T obj, Class... cs) { + for (Class c : cs) { + assertInstance(obj, c); + } + return (U) obj; + } + + private IBinding binding(String section, int len) { + IASTName astName = findName(section, len); + final String selection = section.substring(0, len); + assertNotNull("No AST name for \"" + selection + "\"", astName); + assertEquals(selection, astName.getRawSignature()); + + IBinding binding = astName.resolveBinding(); + assertNotNull("No binding for " + astName.getRawSignature(), binding); + + return astName.resolveBinding(); + } + + private IBinding binding(String context, String name) { + IASTName astName = findName(context, name); + assertNotNull("No AST name for \"" + name + "\"", astName); + assertEquals(name, astName.getRawSignature()); + + IBinding binding = astName.resolveBinding(); + assertNotNull("No binding for " + astName.getRawSignature(), binding); + + return astName.resolveBinding(); + } + } +} diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java index d31e6b45b02..48365cf1ef8 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/SemanticsTests.java @@ -88,7 +88,7 @@ public class SemanticsTests extends AST2TestBase { // }; public void testConversionOperators() throws Exception { // Test getDeclaredConversionOperators() - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true); + BindingAssertionHelper ba= new AST2AssertionHelper(getAboveComment(), true); ICPPClassType c= ba.assertNonProblem("X {", 1, ICPPClassType.class); ICPPMethod[] cops= SemanticUtil.getDeclaredConversionOperators(c, null); assertEquals(2, cops.length); diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java index 703d0318beb..843be3a3ed7 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/TypeTraitsTests.java @@ -38,7 +38,7 @@ public class TypeTraitsTests extends AST2TestBase { protected BindingAssertionHelper getAssertionHelper() throws ParserException, IOException { String code= getAboveComment(); - return new BindingAssertionHelper(code, true); + return new AST2AssertionHelper(code, true); } // struct A { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java index 29422127409..66c4a55e796 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/VariableReadWriteFlagsTest.java @@ -27,7 +27,7 @@ public class VariableReadWriteFlagsTest extends AST2TestBase { private static final int READ = PDOMName.READ_ACCESS; private static final int WRITE = PDOMName.WRITE_ACCESS; - protected class AssertionHelper extends BindingAssertionHelper { + protected class AssertionHelper extends AST2AssertionHelper { AssertionHelper(String contents, boolean isCPP) throws ParserException { super(contents, isCPP); } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java index d4d4530cba5..8ba165b3c0e 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexBindingResolutionTestBase.java @@ -39,10 +39,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndexManager; import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.parser.tests.ast2.SemanticTestBase; import org.eclipse.cdt.core.testplugin.CProjectHelper; import org.eclipse.cdt.core.testplugin.CTestPlugin; import org.eclipse.cdt.core.testplugin.TestScannerProvider; -import org.eclipse.cdt.core.testplugin.util.BaseTestCase; import org.eclipse.cdt.core.testplugin.util.TestSourceReader; import org.eclipse.cdt.internal.core.CCoreInternals; import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; @@ -67,7 +67,7 @@ import org.osgi.framework.Bundle; * This class is for testing the process by which bindings are looked up in * the PDOM purely from AST information (i.e. without a real binding from the DOM). */ -public abstract class IndexBindingResolutionTestBase extends BaseTestCase { +public abstract class IndexBindingResolutionTestBase extends SemanticTestBase { private static final boolean DEBUG= false; private static final String END_OF_ADDED_CODE_MARKER = "/*END_OF_ADDED_CODE*/"; protected ITestStrategy strategy; diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/LinkedNamesFinderTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/LinkedNamesFinderTest.java index c79b1ee45f9..f691e11e71c 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/LinkedNamesFinderTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/search/LinkedNamesFinderTest.java @@ -61,7 +61,7 @@ public class LinkedNamesFinderTest extends AST2TestBase { } private IRegion[] getLinkedRegions(String code, String name, int len, boolean isCpp) throws ParserException { - BindingAssertionHelper ba= new BindingAssertionHelper(code, isCpp); + BindingAssertionHelper ba= new AST2AssertionHelper(code, isCpp); IASTName astName = ba.findName(name, len); IRegion[] regions = LinkedNamesFinder.findByName(ba.getTranslationUnit(), astName); Arrays.sort(regions, REGION_COMPARATOR);