changeset 51339:08c77757320c

8205442: Avoid hard-coding --source value in SourceLauncherTest.java Reviewed-by: darcy
author jjg
date Thu, 21 Jun 2018 14:33:15 -0700
parents 1a3f1cf62456
children 68d2c5575e68
files test/langtools/tools/javac/launcher/SourceLauncherTest.java
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/langtools/tools/javac/launcher/SourceLauncherTest.java	Thu Jun 21 13:29:44 2018 -0700
+++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java	Thu Jun 21 14:33:15 2018 -0700
@@ -121,7 +121,7 @@
     @Test
     public void testHelloWorldWithShebang(Path base) throws IOException {
         tb.writeJavaFiles(base,
-            "#!/usr/bin/java --source 11\n" +
+            "#!/usr/bin/java --source " + thisVersion + "\n" +
             "import java.util.Arrays;\n" +
             "class HelloWorld {\n" +
             "    public static void main(String... args) {\n" +
@@ -205,7 +205,7 @@
     @Test
     public void testHelloWorldWithShebangJava(Path base) throws IOException {
         tb.writeJavaFiles(base,
-            "#!/usr/bin/java --source 11\n" +
+            "#!/usr/bin/java --source " + thisVersion + "\n" +
             "import java.util.Arrays;\n" +
             "class HelloWorld {\n" +
             "    public static void main(String... args) {\n" +
@@ -215,10 +215,10 @@
         Path file = base.resolve("HelloWorld.java");
         testError(file,
             file + ":1: error: illegal character: '#'\n" +
-            "#!/usr/bin/java --source 11\n" +
+            "#!/usr/bin/java --source " + thisVersion + "\n" +
             "^\n" +
             file + ":1: error: class, interface, or enum expected\n" +
-            "#!/usr/bin/java --source 11\n" +
+            "#!/usr/bin/java --source " + thisVersion + "\n" +
             "  ^\n" +
             "2 errors\n",
             "error: compilation failed");
@@ -305,7 +305,7 @@
     @Test
     public void testBadShebang(Path base) throws IOException {
         tb.writeJavaFiles(base,
-            "#/usr/bin/java --source 11\n" +
+            "#/usr/bin/java --source " + thisVersion + "\n" +
             "import java.util.Arrays;\n" +
             "class HelloWorld {\n" +
             "    public static void main(String... args) {\n" +
@@ -315,10 +315,10 @@
         Path file = base.resolve("HelloWorld.java");
         testError(file,
             file + ":1: error: illegal character: '#'\n" +
-            "#/usr/bin/java --source 11\n" +
+            "#/usr/bin/java --source " + thisVersion + "\n" +
             "^\n" +
             file + ":1: error: class, interface, or enum expected\n" +
-            "#/usr/bin/java --source 11\n" +
+            "#/usr/bin/java --source " + thisVersion + "\n" +
             "  ^\n" +
             "2 errors\n",
             "error: compilation failed");