You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/08/05 16:45:10 UTC

groovy git commit: Fix the test gls.generics.GenericsTest.testCompilationWithMissingClosingBracketsInGenerics

Repository: groovy
Updated Branches:
  refs/heads/master 36a51e170 -> 5c63ad68f


Fix the test gls.generics.GenericsTest.testCompilationWithMissingClosingBracketsInGenerics


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5c63ad68
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5c63ad68
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5c63ad68

Branch: refs/heads/master
Commit: 5c63ad68f00def641446445b18bb45d5a9dbab26
Parents: 36a51e1
Author: sunlan <su...@apache.org>
Authored: Sun Aug 6 00:45:00 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Sun Aug 6 00:45:00 2017 +0800

----------------------------------------------------------------------
 src/test/gls/generics/GenericsTest.groovy | 111 +++++++++++++++++--------
 1 file changed, 75 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/5c63ad68/src/test/gls/generics/GenericsTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/generics/GenericsTest.groovy b/src/test/gls/generics/GenericsTest.groovy
index 91b9567..e7a98fa 100644
--- a/src/test/gls/generics/GenericsTest.groovy
+++ b/src/test/gls/generics/GenericsTest.groovy
@@ -357,42 +357,81 @@ import java.util.concurrent.atomic.AtomicInteger
     }
 
     void testCompilationWithMissingClosingBracketsInGenerics() {
-        shouldFailCompilationWithExpectedMessage """
-            def list1 = new ArrayList<Integer()
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            List<Integer list2 = new ArrayList<Integer>()
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            def c = []
-            for (Iterator<String i = c.iterator(); i.hasNext(); ) { }
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            def m(Class<Integer someParam) {}
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            abstract class ArrayList1<E extends AbstractList<E> implements List<E> {}
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            abstract class ArrayList2<E> extends AbstractList<E implements List<E> {}
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            abstract class ArrayList3<E> extends AbstractList<E> implements List<E {}
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            def List<List<Integer> history = new ArrayList<List<Integer>>()
-        """
-
-        shouldFailCompilationWithExpectedMessage """
-            def List<List<Integer>> history = new ArrayList<List<Integer>()
-        """
+        if (CompilerConfiguration.DEFAULT.antlr2Parser) {
+            shouldFailCompilationWithExpectedMessage """
+                def list1 = new ArrayList<Integer()
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                List<Integer list2 = new ArrayList<Integer>()
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                def c = []
+                for (Iterator<String i = c.iterator(); i.hasNext(); ) { }
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                def m(Class<Integer someParam) {}
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                abstract class ArrayList1<E extends AbstractList<E> implements List<E> {}
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                abstract class ArrayList2<E> extends AbstractList<E implements List<E> {}
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                abstract class ArrayList3<E> extends AbstractList<E> implements List<E {}
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                def List<List<Integer> history = new ArrayList<List<Integer>>()
+            """
+
+            shouldFailCompilationWithExpectedMessage """
+                def List<List<Integer>> history = new ArrayList<List<Integer>()
+            """
+        } else {
+            shouldFailCompilationWithMessage """
+                def list1 = new ArrayList<Integer()
+            """, "Unexpected input: 'new ArrayList<Integer('"
+
+            shouldFailCompilationWithMessage """
+                List<Integer list2 = new ArrayList<Integer>()
+            """, "Unexpected input: 'list2'"
+
+            shouldFailCompilationWithMessage """
+                def c = []
+                for (Iterator<String i = c.iterator(); i.hasNext(); ) { }
+            """, "Unexpected input: 'Iterator<String i'"
+
+            shouldFailCompilationWithMessage """
+                def m(Class<Integer someParam) {}
+            """, "Unexpected input: 'Class<Integer someParam'"
+
+            shouldFailCompilationWithMessage """
+                abstract class ArrayList1<E extends AbstractList<E> implements List<E> {}
+            """, "Unexpected input: 'implements'"
+
+            shouldFailCompilationWithMessage """
+                abstract class ArrayList2<E> extends AbstractList<E implements List<E> {}
+            """, "Unexpected input: 'AbstractList<E implements'"
+
+            shouldFailCompilationWithMessage """
+                abstract class ArrayList3<E> extends AbstractList<E> implements List<E {}
+            """, "Unexpected input: '<'"
+
+            shouldFailCompilationWithMessage """
+                def List<List<Integer> history = new ArrayList<List<Integer>>()
+            """, "Unexpected input: 'def List<List<Integer> history'"
+
+            shouldFailCompilationWithMessage """
+                def List<List<Integer>> history = new ArrayList<List<Integer>()
+            """, "Unexpected input: 'new ArrayList<List<Integer>('"
+        }
     }
 
     private void shouldFailCompilationWithExpectedMessage(scriptText) {