< prev index next >

test/langtools/tools/javac/expswitch/ExpSwitchNestingTest.java

Print this page

        

@@ -73,20 +73,22 @@
         if (!result.isSuccess()) {
             System.err.printf("Diagnostics: %s%nTemplate: %s%n", diags.errorKeys(), sourceFiles.stream().map(p -> p.snd).collect(toList()));
         }
     }
 
+    private static String[] PREVIEW_OPTIONS = {"--enable-preview", "-source", "13"};
+
     private void program(String... constructs) {
         String s = "class C { static boolean cond = false; static int x = 0; void m() { # } }";
         for (String c : constructs)
             s = s.replace("#", c);
         addSourceFile("C.java", new StringTemplate(s));
     }
 
     private void assertOK(String... constructs) {
         reset();
-        addCompileOptions("--enable-preview", "-source", "12");
+        addCompileOptions(PREVIEW_OPTIONS);
         program(constructs);
         try {
             compile();
         }
         catch (IOException e) {

@@ -95,11 +97,11 @@
         assertCompileSucceeded();
     }
 
     private void assertOKWithWarning(String warning, String... constructs) {
         reset();
-        addCompileOptions("--enable-preview", "-source", "12");
+        addCompileOptions(PREVIEW_OPTIONS);
         program(constructs);
         try {
             compile();
         }
         catch (IOException e) {

@@ -108,11 +110,11 @@
         assertCompileSucceededWithWarning(warning);
     }
 
     private void assertFail(String expectedDiag, String... constructs) {
         reset();
-        addCompileOptions("--enable-preview", "-source", "12");
+        addCompileOptions(PREVIEW_OPTIONS);
         program(constructs);
         try {
             compile();
         }
         catch (IOException e) {
< prev index next >