You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/10/23 04:54:11 UTC
groovy git commit: some JDK9 test fixes
Repository: groovy
Updated Branches:
refs/heads/master cc9c0633e -> 7cec8322e
some JDK9 test fixes
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7cec8322
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7cec8322
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7cec8322
Branch: refs/heads/master
Commit: 7cec8322e773e4d467989eb445efa20846220d2f
Parents: cc9c063
Author: paulk <pa...@asert.com.au>
Authored: Mon Oct 23 14:54:02 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Mon Oct 23 14:54:02 2017 +1000
----------------------------------------------------------------------
src/test/gls/annotations/AnnotationTest.groovy | 10 +++++++---
src/test/groovy/execute/ExecuteTest.groovy | 16 ++++++++++++----
.../m12n/ExtensionModuleHelperForTests.groovy | 2 +-
3 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/7cec8322/src/test/gls/annotations/AnnotationTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/annotations/AnnotationTest.groovy b/src/test/gls/annotations/AnnotationTest.groovy
index 2f1b713..be77a16 100644
--- a/src/test/gls/annotations/AnnotationTest.groovy
+++ b/src/test/gls/annotations/AnnotationTest.groovy
@@ -710,7 +710,11 @@ class AnnotationTest extends CompilableTestSupport {
import java.lang.annotation.*
class MyClass {
- private static final expected = '@MyAnnotationArray(value=[@MyAnnotation(value=val1), @MyAnnotation(value=val2)])'
+ // TODO confirm the JDK9 behavior is what we expect
+ private static final List<String> expected = [
+ '@MyAnnotationArray(value=[@MyAnnotation(value=val1), @MyAnnotation(value=val2)])', // JDK5-8
+ '@MyAnnotationArray(value={@MyAnnotation(value="val1"), @MyAnnotation(value="val2")})' // JDK9
+ ]
// control
@MyAnnotationArray([@MyAnnotation("val1"), @MyAnnotation("val2")])
@@ -725,8 +729,8 @@ class AnnotationTest extends CompilableTestSupport {
MyClass myc = new MyClass()
assert 'method1' == myc.method1()
assert 'method2' == myc.method2()
- assert checkAnnos(myc, "method1") == expected
- assert checkAnnos(myc, "method2") == expected
+ assert expected.contains(checkAnnos(myc, "method1"))
+ assert expected.contains(checkAnnos(myc, "method2"))
}
private static String checkAnnos(MyClass myc, String name) {
http://git-wip-us.apache.org/repos/asf/groovy/blob/7cec8322/src/test/groovy/execute/ExecuteTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/execute/ExecuteTest.groovy b/src/test/groovy/execute/ExecuteTest.groovy
index 8d29f15..78d9a9a 100644
--- a/src/test/groovy/execute/ExecuteTest.groovy
+++ b/src/test/groovy/execute/ExecuteTest.groovy
@@ -20,8 +20,6 @@ package groovy.execute
/**
* Cross platform tests for the DGM#execute() family of methods.
- *
- * @author Paul King
*/
class ExecuteTest extends GroovyTestCase {
private String getCmd() {
@@ -68,12 +66,17 @@ class ExecuteTest extends GroovyTestCase {
}
void testExecuteCommandLineProcessAndUseWaitForOrKill() {
- String[] java = [System.getProperty('java.home') + "/bin/java",
+ List<String> javaArgs = [System.getProperty('java.home') + "/bin/java",
"-classpath",
System.getProperty('java.class.path'),
"groovy.ui.GroovyMain",
"-e",
"sleep(2000); println('Done'); System.exit(0)"]
+ if (System.getProperty('java.specification.version') >= '9') {
+ javaArgs.add(3, '--add-modules')
+ javaArgs.add(4, 'ALL-SYSTEM')
+ }
+ String[] java = javaArgs.toArray()
println "Executing this command for two cases:\n${java.join(' ')}"
StringBuffer sbout = new StringBuffer()
StringBuffer sberr = new StringBuffer()
@@ -115,12 +118,17 @@ class ExecuteTest extends GroovyTestCase {
}
void testExecuteCommandLineWithEnvironmentProperties() {
- String[] java = [System.getProperty('java.home') + "/bin/java",
+ List<String> javaArgs = [System.getProperty('java.home') + "/bin/java",
"-classpath",
System.getProperty('java.class.path'),
"groovy.ui.GroovyMain",
"-e",
"println(System.getenv('foo'))"]
+ if (System.getProperty('java.specification.version') >= '9') {
+ javaArgs.add(3, '--add-modules')
+ javaArgs.add(4, 'ALL-SYSTEM')
+ }
+ String[] java = javaArgs.toArray()
println "Executing this command:\n${java.join(' ')}"
def props = ["foo=bar"]
StringBuffer sbout = new StringBuffer()
http://git-wip-us.apache.org/repos/asf/groovy/blob/7cec8322/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy b/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy
index 859f1cd..6eaefbe 100644
--- a/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy
+++ b/src/test/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy
@@ -80,7 +80,7 @@ public class ExtensionModuleHelperForTests {
baseDir.deleteDir()
if (err && !allowed.any{ err.trim().matches(it) }) {
throw new RuntimeException("$err\nClasspath: ${cp.join('\n')}")
- } else if ( out.contains('FAILURES') || ! out.contains("OK")) {
+ } else if (out && out.contains('FAILURES') || ! out.contains("OK")) {
throw new RuntimeException("$out\nClasspath: ${cp.join('\n')}")
}
}