v/vlib/v/tests/static_vars_test.v

17 lines
196 B
V

[unsafe]
fn foo() int {
static x := 42
x++
return x
}
fn xfoo() int {
return unsafe { foo() }
}
fn test_static_vars_work() {
assert xfoo() == 43
assert xfoo() == 44
assert xfoo() == 45
}