Skip to content

Commit

Permalink
Fix up a few tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Mar 18, 2018
1 parent 56ed572 commit 393c6d8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 the original author or authors.
* Copyright 2009-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -106,7 +106,7 @@ public void testAccessForImplements() {
String source = "import java.beans.*\n" +
"abstract class Foo implements BeanInfo {}";

assertAccessRestriction(source, "BeanInfo "); // interface has +1 sloc...
assertAccessRestriction(source, "BeanInfo");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.eclipse.jdt.core.groovy.tests.locations;

import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isParrotParser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -259,7 +260,7 @@ public void testBinaryExpr7() throws Exception {
checkBinaryExprSLocs(
" a = b ",
new BinaryExpressionSLocTester(),
Boolean.getBoolean("groovy.antlr4") ? "a = b" : "a = b ");
isParrotParser() ? "a = b" : "a = b ");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2017 the original author or authors.
* Copyright 2009-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,4 +29,8 @@ public abstract class GroovyBundle {
public static boolean isAtLeastGroovy(int level) {
return (GROOVY_LEVEL >= level);
}

public static boolean isParrotParser() {
return (isAtLeastGroovy(26) && Boolean.getBoolean("groovy.antlr4"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.eclipse.jdt.groovy.core.tests.basic;

import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isParrotParser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -516,7 +517,7 @@ public void testParsingRecovery_GRE1107_1() {
" }\n" +
"}\n",
},
Boolean.getBoolean("groovy.antlr4") ? "" :
isParrotParser() ? "" :
"----------\n" +
"1. ERROR in foo\\X.groovy (at line 6)\n" +
"\tdo {\n" +
Expand Down Expand Up @@ -549,7 +550,7 @@ public void testParsingRecovery_GRE1107_2() {
" }\n" +
"}\n",
},
Boolean.getBoolean("groovy.antlr4") ? "" :
isParrotParser() ? "" :
"----------\n" +
"1. ERROR in foo\\X.groovy (at line 7)\n" +
"\tdo {\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.eclipse.jdt.groovy.core.tests.basic;

import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isAtLeastGroovy;
import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isParrotParser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -2331,12 +2332,13 @@ public void testMemberTypeResolution() {
public void testFailureWhilstAttemptingToReportError() {
runNegativeTest(new String[] {
"T.groovy",
"public class T{\n"+
" def x () {\n"+
" this \"\"\n"+
"public class T {\n" +
" def x () {\n" +
" this \"\"\n" + // not a ctor call
" }\n"+
"}\n"
"}\n",
},
isParrotParser() ? "" :
"----------\n" +
"1. ERROR in T.groovy (at line 3)\n" +
"\tthis \"\"\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.eclipse.jdt.groovy.core.tests.basic;

import static org.eclipse.jdt.groovy.core.tests.GroovyBundle.isParrotParser;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;

Expand Down Expand Up @@ -846,7 +847,7 @@ public void testTypeChecked1() {
"----------\n" +
"2. ERROR in Foo.groovy (at line 5)\n" +
"\tprintln \"Did you spot the error in this ${message.toUppercase()}?\"\n" +
"\t " + (Boolean.getBoolean("groovy.antlr4") ? " ^^^^^^^^^^^^^^^^^^^^^" : "^^^^^^^^^^^^^^^^^^^^^^^") + "\n" +
"\t " + (isParrotParser() ? " ^^^^^^^^^^^^^^^^^^^^^" : "^^^^^^^^^^^^^^^^^^^^^^^") + "\n" +
"Groovy:[Static type checking] - Cannot find matching method java.lang.String#toUppercase(). Please check if the declared type is correct and if the method exists.\n" +
"----------\n");
}
Expand Down

0 comments on commit 393c6d8

Please sign in to comment.