From 1c570e7bbbbcc55c68bde170285a12ca2ed6046e Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 11 Nov 2012 11:39:53 -0800 Subject: [PATCH] Code streamlining. --- .../parser/tests/ast2/AST2TemplateTests.java | 163 ++++++------------ 1 file changed, 57 insertions(+), 106 deletions(-) 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 8a5cd047e16..1c5ca3c8136 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 @@ -2275,8 +2275,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(p); // } public void testFunctionTemplate_272848_1() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -2292,8 +2291,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(p); // } public void testFunctionTemplate_272848_2() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -2306,8 +2304,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(x); // } public void testFunctionTemplate_309564() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void f1(void(*f)(const U&)) {} @@ -2316,8 +2313,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f1(&f2); // problem on f1 // } public void testSimplifiedFunctionTemplateWithFunctionPointer_281783() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -2635,8 +2631,7 @@ public class AST2TemplateTests extends AST2BaseTest { // AI y; // AT z; public void testDefaultTemplateParameter_281781() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // class A {}; @@ -3251,7 +3246,7 @@ public class AST2TemplateTests extends AST2BaseTest { // }; // } public void testBug238180_ArrayOutOfBounds() throws Exception { - // the code above used to trigger an ArrayOutOfBoundsException + // The code above used to trigger an ArrayOutOfBoundsException parse(getAboveComment(), CPP); } @@ -3554,8 +3549,7 @@ public class AST2TemplateTests extends AST2BaseTest { // xt.partial; // } public void testDefaultArgsWithPartialSpecialization() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class XT { @@ -3960,8 +3954,7 @@ public class AST2TemplateTests extends AST2BaseTest { // } // }; public void testResolutionOfUnknownFunctions() throws Exception { - String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // class C {}; @@ -3973,8 +3966,7 @@ public class AST2TemplateTests extends AST2BaseTest { // } // }; public void testResolutionOfUnknownArrayAccess() throws Exception { - String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class CT { @@ -3987,7 +3979,7 @@ public class AST2TemplateTests extends AST2BaseTest { // x.append(3, 'c'); // } public void testConflictInTemplateArgumentDeduction() throws Exception { - String code= getAboveComment(); + final String code= getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); ICPPMethod m= bh.assertNonProblem("append(3", 6); @@ -4028,10 +4020,9 @@ public class AST2TemplateTests extends AST2BaseTest { // return A(p); // } public void testForwardDeclarations_264109() throws Exception { - final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("A make_A(C* p) {", 4, ICPPTemplateInstance.class); - parseAndCheckBindings(code); + parseAndCheckBindings(getAboveComment()); } // template class CT { @@ -4044,8 +4035,7 @@ public class AST2TemplateTests extends AST2BaseTest { // any(CT(iptr)); // } public void testConstructorTemplateInClassTemplate_264314() throws Exception { - String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class XT {}; @@ -4062,8 +4052,7 @@ public class AST2TemplateTests extends AST2BaseTest { // func(y, xy, xint); // } public void testDistinctDeferredInstances_264367() throws Exception { - String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class XT { @@ -4072,8 +4061,7 @@ public class AST2TemplateTests extends AST2BaseTest { // } // }; public void testUnknownParameter_264988() throws Exception { - String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -4084,8 +4072,7 @@ public class AST2TemplateTests extends AST2BaseTest { // int x = A<0>::e; // A<0>::E y; public void testEnumeratorInTemplateInstance_265070() throws Exception { - String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class CT {}; @@ -4096,10 +4083,9 @@ public class AST2TemplateTests extends AST2BaseTest { // getline2(i); // } public void testAmbiguousDeclaratorInFunctionTemplate_265342() throws Exception { - final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); bh.assertNonProblem("getline2(i)", 8, ICPPTemplateInstance.class); - parseAndCheckBindings(code); + parseAndCheckBindings(getAboveComment()); } // class C { @@ -4115,8 +4101,7 @@ public class AST2TemplateTests extends AST2BaseTest { // }; // }; public void testOwnerOfFriendTemplate_265671() throws Exception { - final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); IFunction f= bh.assertNonProblem("f1(", 2, IFunction.class); IBinding owner= f.getOwner(); assertNull(owner); @@ -4133,7 +4118,7 @@ public class AST2TemplateTests extends AST2BaseTest { tpar= bh.assertNonProblem("T3", 2, ICPPTemplateParameter.class); assertEquals(2, tpar.getTemplateNestingLevel()); - parseAndCheckBindings(code); + parseAndCheckBindings(getAboveComment()); } // template void f(T t) { @@ -4141,13 +4126,12 @@ public class AST2TemplateTests extends AST2BaseTest { // } // template void g(T t) {} public void testDependentNameReferencingLaterDeclaration_265926a() throws Exception { - final String code = getAboveComment(); - BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), CPP); IFunction gref= bh.assertNonProblem("g(t)", 1); assertInstance(gref, ICPPUnknownBinding.class); IFunction gdecl= bh.assertNonProblem("g(T t)", 1); - parseAndCheckBindings(code); + parseAndCheckBindings(getAboveComment()); } // class C; @@ -4167,8 +4151,7 @@ public class AST2TemplateTests extends AST2BaseTest { // void a() {}; // }; public void testDependentNameReferencingLaterDeclaration_265926b() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class XT { @@ -4179,22 +4162,20 @@ public class AST2TemplateTests extends AST2BaseTest { // } // }; public void testDeferredConversionOperator() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class X {}; // template class X1 { // friend class X; // }; - // template class Y : X1 { + // template class Y : X1 { // void test() { // X x; // problem binding on X // } // }; public void testFriendClassTemplate_266992() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -4233,8 +4214,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(p); // } public void testTemplateConversionOperator_271948_1() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -4253,16 +4233,14 @@ public class AST2TemplateTests extends AST2BaseTest { // f(x); // } public void testTemplateConversionOperator_271948_2() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template struct ST{}; // template class T> class CT {}; // typedef CT TDef; public void testUsingTemplateTemplateParameter_279619() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void T(int (&array)[N]) {}; @@ -4271,8 +4249,7 @@ public class AST2TemplateTests extends AST2BaseTest { // T<2>(a); // } public void testInstantiationOfArraySize_269926() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class CT { @@ -4281,8 +4258,7 @@ public class AST2TemplateTests extends AST2BaseTest { // void CT::init(void) { // } public void testMethodSpecialization_322988() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code, CPP); + parseAndCheckBindings(); } @@ -4296,8 +4272,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(x); // } public void testInlineFriendFunction_284690_1() throws Exception { - final String code = getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -4335,8 +4310,7 @@ public class AST2TemplateTests extends AST2BaseTest { // typedef NullType Type; // }; public void testDefaultArgument_289132() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class XT { @@ -4395,8 +4369,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(ch, cint); // } public void testFunctionTemplateOrdering_293468() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void func(T* t) {}; @@ -4413,8 +4386,7 @@ public class AST2TemplateTests extends AST2BaseTest { // func1 (a); // } public void testFunctionTemplateOrdering_294539() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class CT {}; @@ -4427,8 +4399,7 @@ public class AST2TemplateTests extends AST2BaseTest { // return a; // } public void testClosingAngleBrackets1_261268() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class CT {}; @@ -4457,8 +4428,7 @@ public class AST2TemplateTests extends AST2BaseTest { // a < a >> (1+2); // binary expression via ambiguity // } public void testClosingAngleBracketsAmbiguity_261268() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // #define OPASSIGN(x) x##= @@ -4467,8 +4437,7 @@ public class AST2TemplateTests extends AST2BaseTest { // a OPASSIGN(>>) 1; // } public void testTokenPasteShiftROperator_261268() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class X { @@ -4602,16 +4571,14 @@ public class AST2TemplateTests extends AST2BaseTest { // CTx<1,2> c; // } public void testNonTypeTemplateParameterPack_280909() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template // struct count { static const int value = sizeof...(Types); // }; public void testVariadicTemplateExamples_280909a() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void f(T (* ...t)(int, int)); @@ -4621,8 +4588,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(add, subtract); // } public void testVariadicTemplateExamples_280909b() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template @@ -4631,15 +4597,13 @@ public class AST2TemplateTests extends AST2BaseTest { // X(const Mixins&... mixins) : Mixins(mixins)... { } // }; public void testVariadicTemplateExamples_280909c() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class Tuple; // Types is a template type parameter pack // template struct multi array; // Dims is a non-type template parameter pack public void testVariadicTemplateExamples_280909d() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class String; @@ -4748,8 +4712,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(0, 0, 0); // Types is the sequence int*, float*, int // } public void testVariadicTemplateExamples_280909j() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void f(Types&...); @@ -4760,8 +4723,7 @@ public class AST2TemplateTests extends AST2BaseTest { // g(x, y, z); // T1 is deduced to int, Types is deduced to float, int // } public void testVariadicTemplateExamples_280909k() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template struct X { }; @@ -4778,8 +4740,7 @@ public class AST2TemplateTests extends AST2BaseTest { // Y y3; // uses primary template, Types contains int, float, double // int fv = f(g); // okay, Types contains int, float public void testVariadicTemplateExamples_280909n() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template struct Tuple { }; @@ -4805,8 +4766,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(2, 1.0); // okay: args contains two arguments, an int and a double // } public void testVariadicTemplateExamples_280909q() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void f(Types... rest); @@ -4814,8 +4774,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(&rest...); // '&rest...' is a pack expansion, '&rest' is its pattern // } public void testVariadicTemplateExamples_280909r() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template struct Tuple {}; @@ -4865,8 +4824,7 @@ public class AST2TemplateTests extends AST2BaseTest { // bind(&Test::Update); // } public void testFunctionOrdering_299608() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void f(T t = 0, U u = 0); @@ -4975,8 +4933,7 @@ public class AST2TemplateTests extends AST2BaseTest { // CT::CT() : value_(0) { // } public void testConstructorOfExplicitSpecialization() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template struct CT; @@ -5024,8 +4981,7 @@ public class AST2TemplateTests extends AST2BaseTest { // CT::T2 b; // } public void testBug306213c() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class CT {}; @@ -5102,7 +5058,7 @@ public class AST2TemplateTests extends AST2BaseTest { // template void N::f(int&); // template<> void N::f(long&) {} public void testInlineNamespaces_305980() throws Exception { - final String code= getAboveComment(); + final String code = getAboveComment(); parseAndCheckBindings(code); BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP); ICPPFunctionTemplate ft= bh.assertNonProblem("f(T&)", 1); @@ -5138,8 +5094,7 @@ public class AST2TemplateTests extends AST2BaseTest { // g(x); // } public void testUnnamedTypesAsTemplateArgument_316317a() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template class X { }; @@ -5158,8 +5113,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(b); // OK // } public void testUnnamedTypesAsTemplateArgument_316317b() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // struct S { @@ -5175,8 +5129,7 @@ public class AST2TemplateTests extends AST2BaseTest { // (x + 1)->s; // } public void testOverloadResolutionBetweenMethodTemplateAndFunction() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template void f(T..., T...); @@ -5184,8 +5137,7 @@ public class AST2TemplateTests extends AST2BaseTest { // f(1,1); // } public void testFunctionParameterPacksInNonFinalPosition_324096() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template struct OutStream { @@ -5693,8 +5645,7 @@ public class AST2TemplateTests extends AST2BaseTest { // typedef r::s t; // t::u x; public void testBoolExpressionAsTemplateArgument_361604() throws Exception { - final String code= getAboveComment(); - parseAndCheckBindings(code); + parseAndCheckBindings(); } // template struct B {