groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [1/3] groovy git commit: some JDK9 test fixes
Date Mon, 23 Oct 2017 10:26:40 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X c5299d974 -> 7f7da9985


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/5c6e5407
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5c6e5407
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5c6e5407

Branch: refs/heads/GROOVY_2_6_X
Commit: 5c6e5407261fd00eed48274c5612b51e711d6048
Parents: c5299d9
Author: paulk <paulk@asert.com.au>
Authored: Mon Oct 23 14:54:02 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Mon Oct 23 20:16:33 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/5c6e5407/src/test/gls/annotations/AnnotationTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/annotations/AnnotationTest.groovy b/src/test/gls/annotations/AnnotationTest.groovy
index 504f0e8..fae832d 100644
--- a/src/test/gls/annotations/AnnotationTest.groovy
+++ b/src/test/gls/annotations/AnnotationTest.groovy
@@ -712,7 +712,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")])
@@ -727,8 +731,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/5c6e5407/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/5c6e5407/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')}")
             }
         }


Mime
View raw message