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 2020/10/21 03:58:06 UTC
[groovy] branch master updated: fix tests-preview also for JDK15
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 418691a fix tests-preview also for JDK15
418691a is described below
commit 418691a0ed911f745ffbfdb0a770380a5ca8cb3b
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Oct 21 13:57:55 2020 +1000
fix tests-preview also for JDK15
---
subprojects/tests-preview/build.gradle | 4 +++-
.../src/test/groovy/groovy/bugs/vm14/Groovy9505.groovy | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/subprojects/tests-preview/build.gradle b/subprojects/tests-preview/build.gradle
index b5d03a2..3426bf9 100644
--- a/subprojects/tests-preview/build.gradle
+++ b/subprojects/tests-preview/build.gradle
@@ -28,7 +28,9 @@ dependencies {
}
tasks.withType(Test).configureEach {
- jvmArgs += "--enable-preview"
+ if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
+ jvmArgs += "--enable-preview"
+ }
}
sourceSets {
diff --git a/subprojects/tests-preview/src/test/groovy/groovy/bugs/vm14/Groovy9505.groovy b/subprojects/tests-preview/src/test/groovy/groovy/bugs/vm14/Groovy9505.groovy
index 485d2fd..a4cc9d7 100644
--- a/subprojects/tests-preview/src/test/groovy/groovy/bugs/vm14/Groovy9505.groovy
+++ b/subprojects/tests-preview/src/test/groovy/groovy/bugs/vm14/Groovy9505.groovy
@@ -22,12 +22,12 @@ import groovy.test.GroovyTestCase
class Groovy9505 extends GroovyTestCase {
void testUsingRecord() {
- assertScript '''
+ assertScript """
import org.apache.groovy.util.JavaShell
- def opts = ['--enable-preview', '--release', '14']
+ def opts = ['--enable-preview', '--release', '${System.getProperty('java.specification.version')}']
def src = 'record Coord(int x, int y) {}'
Class coordClass = new JavaShell().compile('Coord', opts, src)
assert coordClass.newInstance(5, 10).toString() == 'Coord[x=5, y=10]'
- '''
+ """
}
}