1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
Files
v/vlib/v/tests/goto_test.v
2021-10-28 10:40:31 +03:00

39 lines
409 B
V

fn test_goto() {
mut i := 0
a:
b := 1
_ = b
i++
if i < 3 {
unsafe {
goto a
}
}
assert i == 3
}
pub fn test_goto_after_return() {
a, b, c, d := 4, 5, 6, 7
for {
for {
for {
if a == 4 {
if b == 5 {
if c == 6 {
if d == 7 {
unsafe {
goto finally_ok
}
}
}
}
}
}
}
}
assert false
return
finally_ok:
assert true
}