< prev index next >

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

Print this page
rev 51258 : imported patch switch
rev 51259 : imported patch switch.01

*** 36,45 **** --- 36,46 ---- private static final String RUNNABLE = "Runnable r = () -> { # };"; private static final String INT_FN = "java.util.function.IntSupplier r = () -> { # };"; private static final String LABEL = "label: #"; private static final String DEF_LABEL_VAR = "int label = 0; { # }"; private static final String FOR = "for (int i=0; i<10; i++) { # }"; + private static final String FOR_EACH = "for (int i : new int[] {}) { # }"; private static final String WHILE = "while (cond) { # }"; private static final String DO = "do { # } while (cond);"; private static final String SSWITCH = "switch (x) { case 0: # };"; private static final String ESWITCH_Z = "int res = switch (x) { case 0 -> { # } default -> 0; };"; private static final String ESWITCH_S = "String res_string = switch (x) { case 0 -> { # } default -> \"default\"; };";
*** 236,241 **** --- 237,250 ---- } public void testFunReturningSwitchExp() { assertOK(INT_FN_ESWITCH, BREAK_INT_FN); } + + public void testContinueLoops() { + assertOK(LABEL, FOR, CONTINUE_L); + assertOK(LABEL, FOR_EACH, CONTINUE_L); + assertOK(LABEL, WHILE, CONTINUE_L); + assertOK(LABEL, DO, CONTINUE_L); + assertFail("compiler.err.not.loop.label", LABEL, CONTINUE_L); + } }
< prev index next >