From a2f25de00b441534d7324cd5d47f2c2eea015af3 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 23 Jan 2015 11:55:09 +0100 Subject: [PATCH] Cleanup (common parameter values delegated) --- .../parser/partial/DeclarationParserTest.java | 96 ++++++++++--------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/lang/java/parser/partial/DeclarationParserTest.java b/java/java-tests/testSrc/com/intellij/lang/java/parser/partial/DeclarationParserTest.java index deed3fc4a4a8..e088797031a4 100644 --- a/java/java-tests/testSrc/com/intellij/lang/java/parser/partial/DeclarationParserTest.java +++ b/java/java-tests/testSrc/com/intellij/lang/java/parser/partial/DeclarationParserTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,20 +24,20 @@ public class DeclarationParserTest extends JavaParsingTestCase { super("parser-partial/declarations"); } - public void testEmptyBody0() { doParserTest("{ }", false, false); } - public void testEmptyBody1() { doParserTest("{ ", false, false); } - public void testEmptyBody2() { doParserTest("{ @Null }", false, false); } + public void testEmptyBody0() { doParserTest("{ }"); } + public void testEmptyBody1() { doParserTest("{ "); } + public void testEmptyBody2() { doParserTest("{ @Null }"); } - public void testNoType() { doParserTest("{ new X(); }", false, false); } - public void testExtraSemicolon() { doParserTest("{ class C { }; }", false, false); } - public void testParameterizedClass() { doParserTest("{ public class A { } }", false, false); } - public void testPines() { doParserTest("{ class A> extends List> { } }", false, false); } - public void testIncompleteAnnotation() { doParserTest("{ public class Foo { public void testSomething(); @Null } }", false, false); } - public void testClassInit() { doParserTest("{ { /*comment*/ } }", false, false); } - public void testAnnoDeclaration() { doParserTest("{ public @interface Annotation {} }", false, false); } + public void testNoType() { doParserTest("{ new X(); }"); } + public void testExtraSemicolon() { doParserTest("{ class C { }; }"); } + public void testParameterizedClass() { doParserTest("{ public class A { } }"); } + public void testPines() { doParserTest("{ class A> extends List> { } }"); } + public void testIncompleteAnnotation() { doParserTest("{ public class Foo { public void testSomething(); @Null } }"); } + public void testClassInit() { doParserTest("{ { /*comment*/ } }"); } + public void testAnnoDeclaration() { doParserTest("{ public @interface Annotation {} }"); } public void testEnumSmartTypeCompletion() { doParserTest("{ @Preliminary(A.B\n#) public class TimeTravel {}\n" + " @Preliminary(a=A.B\n#) public class TimeTravel {}\n" + - " @Preliminary(a=A.B\n#, b=c) public class TimeTravel {} }", false, false); } + " @Preliminary(a=A.B\n#, b=c) public class TimeTravel {} }"); } public void testTypeAnno() { doParserTest("{ class C<@D T extends @F Object> extends @F Object {\n" + " @F int @F[] method() throws @F Exception {\n" + @@ -46,7 +46,7 @@ public class DeclarationParserTest extends JavaParsingTestCase { " c = (@F Object)c;\n" + " Class c = @TA String.class;\n" + " @F C.field++;\n" + - " }\n} }", false, false); + " }\n} }"); } public void testEnumBody0() { doParserTest("{ ; }", false, true); } @@ -62,48 +62,52 @@ public class DeclarationParserTest extends JavaParsingTestCase { public void testAnnoSimple() { doParserTest("{ int foo (); }", true, false); } public void testAnnoDefault() { doParserTest("{ Class foo () default String.class; }", true, false); } public void testAnnoNested() { doParserTest("{ @interface Inner { String bar () default \"\"; } }", true, false); } - public void testAnnoInner() { doParserTest("{ @interface Inner { double bar () default 0.0; } }", false, false); } + public void testAnnoInner() { doParserTest("{ @interface Inner { double bar () default 0.0; } }"); } public void testAnnoOtherMembers() { doParserTest("{ int field;\n void m() {}\n class C {}\n interface I {} }", true, false); } - public void testFieldSimple() { doParserTest("{ int field = 0; }", false, false); } - public void testFieldMulti() { doParserTest("{ int field1 = 0, field2; }", false, false); } - public void testUnclosedBracket() { doParserTest("{ int field[ }", false, false); } - public void testMissingInitializer() { doParserTest("{ int field = }", false, false); } - public void testUnclosedComma() { doParserTest("{ int field, }", false, false); } - public void testUnclosedSemicolon() { doParserTest("{ int field }", false, false); } - public void testMissingInitializerExpression() { doParserTest("{ int field=; }", false, false); } - public void testMultiLineUnclosed() { doParserTest("{ int \n Object o; }", false, false); } - public void testUnclosedField1() { doParserTest("{ String f1\n\n @Anno String f2; }", false, false); } - public void testUnclosedField2() { doParserTest("{ String f1\n\n @Anno\n String f2; }", false, false); } + public void testFieldSimple() { doParserTest("{ int field = 0; }"); } + public void testFieldMulti() { doParserTest("{ int field1 = 0, field2; }"); } + public void testUnclosedBracket() { doParserTest("{ int field[ }"); } + public void testMissingInitializer() { doParserTest("{ int field = }"); } + public void testUnclosedComma() { doParserTest("{ int field, }"); } + public void testUnclosedSemicolon() { doParserTest("{ int field }"); } + public void testMissingInitializerExpression() { doParserTest("{ int field=; }"); } + public void testMultiLineUnclosed() { doParserTest("{ int \n Object o; }"); } + public void testUnclosedField1() { doParserTest("{ String f1\n\n @Anno String f2; }"); } + public void testUnclosedField2() { doParserTest("{ String f1\n\n @Anno\n String f2; }"); } - public void testMethodNormal0() { doParserTest("{ void f() {} }", false, false); } - public void testMethodNormal1() { doParserTest("{ void f(); }", false, false); } - public void testMethodNormal2() { doParserTest("{ default public void f() { } }", false, false); } - public void testSemicolons() { doParserTest("{ void f() {}; void g() {}; }", false, false); } - public void testUnclosed0() { doParserTest("{ void f() }", false, false); } - public void testExtension() { doParserTest("{ default int f() throws E { return 42; } }", false, false); } - public void testUnclosed1() { doParserTest("{ void f( }", false, false); } - public void testUnclosed2() { doParserTest("{ void f()\n void g(); }", false, false); } - public void testUnclosed3() { doParserTest("{ void f(int a }", false, false); } - public void testUnclosed4() { doParserTest("{ void f(int a,, }", false, false); } - public void testUnclosed5() { doParserTest("{ void f(int a,); }", false, false); } + public void testMethodNormal0() { doParserTest("{ void f() {} }"); } + public void testMethodNormal1() { doParserTest("{ void f(); }"); } + public void testMethodNormal2() { doParserTest("{ default public void f() { } }"); } + public void testSemicolons() { doParserTest("{ void f() {}; void g() {}; }"); } + public void testUnclosed0() { doParserTest("{ void f() }"); } + public void testExtension() { doParserTest("{ default int f() throws E { return 42; } }"); } + public void testUnclosed1() { doParserTest("{ void f( }"); } + public void testUnclosed2() { doParserTest("{ void f()\n void g(); }"); } + public void testUnclosed3() { doParserTest("{ void f(int a }"); } + public void testUnclosed4() { doParserTest("{ void f(int a,, }"); } + public void testUnclosed5() { doParserTest("{ void f(int a,); }"); } public void testUnclosed6() { doParserTest("{ void f() default ; }", true, false); } public void testUnclosed7() { doParserTest("{ void f() default {return 42;} }", true, false); } - public void testUnclosed8() { doParserTest("{ void f() default }", false, false); } - public void testConstructorBrackets() { doParserTest("{ A() [] { } }", false, false); } - public void testVarArgBrackets() { doParserTest("{ void foo(int... x[]); }", false, false); } + public void testUnclosed8() { doParserTest("{ void f() default }"); } + public void testConstructorBrackets() { doParserTest("{ A() [] { } }"); } + public void testVarArgBrackets() { doParserTest("{ void foo(int... x[]); }"); } public void testGenericMethod() { doParserTest("{ public static test();\n" + " void test1();\n" + - " String test2(); }", false, false); } - public void testGenericMethodErrors() { doParserTest("{ test (); }", false, false); } - public void testErrors() { doParserTest("{ public static protected int f1 = 0; }", false, false); } - public void testCompletionHack0() { doParserTest("{ \n String s = \"\"; }", false, false); } - public void testCompletionHack1() { doParserTest("{ String test2(); }"); } + public void testGenericMethodErrors() { doParserTest("{ test (); }"); } + public void testErrors() { doParserTest("{ public static protected int f1 = 0; }"); } + public void testCompletionHack0() { doParserTest("{ \n String s = \"\"; }"); } + public void testCompletionHack1() { doParserTest("{ x(Collection x); }", false, false); } - public void testParameterAnnotation() { doParserTest("{ void foo (@Annotation(value=77) int param) {} }", false, false); } - public void testParameterizedMethod() { doParserTest("{ @Nullable T bar() {} }", false, false); } + public void testWildcardParsing() { doParserTest("{ List x(Collection x); }"); } + public void testParameterAnnotation() { doParserTest("{ void foo (@Annotation(value=77) int param) {} }"); } + public void testParameterizedMethod() { doParserTest("{ @Nullable T bar() {} }"); } + + private void doParserTest(String text) { + doParserTest(text, false, false); + } private void doParserTest(String text, boolean isAnnotation, boolean isEnum) { doParserTest(text, new MyTestParser(isAnnotation, isEnum));