< prev index next >

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

Print this page

        

*** 73,92 **** if (!result.isSuccess()) { System.err.printf("Diagnostics: %s%nTemplate: %s%n", diags.errorKeys(), sourceFiles.stream().map(p -> p.snd).collect(toList())); } } 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"); program(constructs); try { compile(); } catch (IOException e) { --- 73,94 ---- 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(PREVIEW_OPTIONS); program(constructs); try { compile(); } catch (IOException e) {
*** 95,105 **** assertCompileSucceeded(); } private void assertOKWithWarning(String warning, String... constructs) { reset(); ! addCompileOptions("--enable-preview", "-source", "12"); program(constructs); try { compile(); } catch (IOException e) { --- 97,107 ---- assertCompileSucceeded(); } private void assertOKWithWarning(String warning, String... constructs) { reset(); ! addCompileOptions(PREVIEW_OPTIONS); program(constructs); try { compile(); } catch (IOException e) {
*** 108,118 **** assertCompileSucceededWithWarning(warning); } private void assertFail(String expectedDiag, String... constructs) { reset(); ! addCompileOptions("--enable-preview", "-source", "12"); program(constructs); try { compile(); } catch (IOException e) { --- 110,120 ---- assertCompileSucceededWithWarning(warning); } private void assertFail(String expectedDiag, String... constructs) { reset(); ! addCompileOptions(PREVIEW_OPTIONS); program(constructs); try { compile(); } catch (IOException e) {
< prev index next >