Skip to content

Commit 5c63ad6

Browse files
committed
Fix the test gls.generics.GenericsTest.testCompilationWithMissingClosingBracketsInGenerics
1 parent 36a51e1 commit 5c63ad6

File tree

1 file changed

+75
-36
lines changed

1 file changed

+75
-36
lines changed

src/test/gls/generics/GenericsTest.groovy

Lines changed: 75 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -357,42 +357,81 @@ import java.util.concurrent.atomic.AtomicInteger
357357
}
358358

359359
void testCompilationWithMissingClosingBracketsInGenerics() {
360-
shouldFailCompilationWithExpectedMessage """
361-
def list1 = new ArrayList<Integer()
362-
"""
363-
364-
shouldFailCompilationWithExpectedMessage """
365-
List<Integer list2 = new ArrayList<Integer>()
366-
"""
367-
368-
shouldFailCompilationWithExpectedMessage """
369-
def c = []
370-
for (Iterator<String i = c.iterator(); i.hasNext(); ) { }
371-
"""
372-
373-
shouldFailCompilationWithExpectedMessage """
374-
def m(Class<Integer someParam) {}
375-
"""
376-
377-
shouldFailCompilationWithExpectedMessage """
378-
abstract class ArrayList1<E extends AbstractList<E> implements List<E> {}
379-
"""
380-
381-
shouldFailCompilationWithExpectedMessage """
382-
abstract class ArrayList2<E> extends AbstractList<E implements List<E> {}
383-
"""
384-
385-
shouldFailCompilationWithExpectedMessage """
386-
abstract class ArrayList3<E> extends AbstractList<E> implements List<E {}
387-
"""
388-
389-
shouldFailCompilationWithExpectedMessage """
390-
def List<List<Integer> history = new ArrayList<List<Integer>>()
391-
"""
392-
393-
shouldFailCompilationWithExpectedMessage """
394-
def List<List<Integer>> history = new ArrayList<List<Integer>()
395-
"""
360+
if (CompilerConfiguration.DEFAULT.antlr2Parser) {
361+
shouldFailCompilationWithExpectedMessage """
362+
def list1 = new ArrayList<Integer()
363+
"""
364+
365+
shouldFailCompilationWithExpectedMessage """
366+
List<Integer list2 = new ArrayList<Integer>()
367+
"""
368+
369+
shouldFailCompilationWithExpectedMessage """
370+
def c = []
371+
for (Iterator<String i = c.iterator(); i.hasNext(); ) { }
372+
"""
373+
374+
shouldFailCompilationWithExpectedMessage """
375+
def m(Class<Integer someParam) {}
376+
"""
377+
378+
shouldFailCompilationWithExpectedMessage """
379+
abstract class ArrayList1<E extends AbstractList<E> implements List<E> {}
380+
"""
381+
382+
shouldFailCompilationWithExpectedMessage """
383+
abstract class ArrayList2<E> extends AbstractList<E implements List<E> {}
384+
"""
385+
386+
shouldFailCompilationWithExpectedMessage """
387+
abstract class ArrayList3<E> extends AbstractList<E> implements List<E {}
388+
"""
389+
390+
shouldFailCompilationWithExpectedMessage """
391+
def List<List<Integer> history = new ArrayList<List<Integer>>()
392+
"""
393+
394+
shouldFailCompilationWithExpectedMessage """
395+
def List<List<Integer>> history = new ArrayList<List<Integer>()
396+
"""
397+
} else {
398+
shouldFailCompilationWithMessage """
399+
def list1 = new ArrayList<Integer()
400+
""", "Unexpected input: 'new ArrayList<Integer('"
401+
402+
shouldFailCompilationWithMessage """
403+
List<Integer list2 = new ArrayList<Integer>()
404+
""", "Unexpected input: 'list2'"
405+
406+
shouldFailCompilationWithMessage """
407+
def c = []
408+
for (Iterator<String i = c.iterator(); i.hasNext(); ) { }
409+
""", "Unexpected input: 'Iterator<String i'"
410+
411+
shouldFailCompilationWithMessage """
412+
def m(Class<Integer someParam) {}
413+
""", "Unexpected input: 'Class<Integer someParam'"
414+
415+
shouldFailCompilationWithMessage """
416+
abstract class ArrayList1<E extends AbstractList<E> implements List<E> {}
417+
""", "Unexpected input: 'implements'"
418+
419+
shouldFailCompilationWithMessage """
420+
abstract class ArrayList2<E> extends AbstractList<E implements List<E> {}
421+
""", "Unexpected input: 'AbstractList<E implements'"
422+
423+
shouldFailCompilationWithMessage """
424+
abstract class ArrayList3<E> extends AbstractList<E> implements List<E {}
425+
""", "Unexpected input: '<'"
426+
427+
shouldFailCompilationWithMessage """
428+
def List<List<Integer> history = new ArrayList<List<Integer>>()
429+
""", "Unexpected input: 'def List<List<Integer> history'"
430+
431+
shouldFailCompilationWithMessage """
432+
def List<List<Integer>> history = new ArrayList<List<Integer>()
433+
""", "Unexpected input: 'new ArrayList<List<Integer>('"
434+
}
396435
}
397436

398437
private void shouldFailCompilationWithExpectedMessage(scriptText) {

0 commit comments

Comments
 (0)