1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/named_break_continue_test.v

47 lines
459 B
V

fn test_labelled_for() {
mut i := 4
unsafe {
goto L1
}
L1: for {
i++
for {
if i < 7 {
continue L1
} else {
break L1
}
}
}
assert i == 7
unsafe {
goto L2
}
L2: for ; true; i++ {
for {
if i < 17 {
continue L2
} else {
break L2
}
}
}
assert i == 17
unsafe {
goto L3
}
L3: for e in [1, 2, 3, 4] {
i = e
for {
if i < 3 {
continue L3
} else {
break L3
}
}
}
assert i == 3
}