aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/vlib/v/checker/tests/labelled_break_continue.vv
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/vlib/v/checker/tests/labelled_break_continue.vv')
-rw-r--r--v_windows/v/vlib/v/checker/tests/labelled_break_continue.vv26
1 files changed, 26 insertions, 0 deletions
diff --git a/v_windows/v/vlib/v/checker/tests/labelled_break_continue.vv b/v_windows/v/vlib/v/checker/tests/labelled_break_continue.vv
new file mode 100644
index 0000000..3447ab1
--- /dev/null
+++ b/v_windows/v/vlib/v/checker/tests/labelled_break_continue.vv
@@ -0,0 +1,26 @@
+fn main() {
+ mut i := 4
+ // check branching to a later loop
+ L1: for {
+ i++
+ for {
+ if i < 7 {continue L2}
+ else {break L2}
+ }
+ }
+ // check branching to an earlier loop
+ L2: for e in [1,2,3,4] {
+ i = e
+ for {
+ if i < 3 {continue L1}
+ else {break L1}
+ }
+ }
+ // check nested loops (not supported ATM)
+ L3: for ;; i++ {
+ L4: for {
+ if i < 17 {continue L3}
+ else {break L3}
+ }
+ }
+}