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

17 lines
200 B
V

[unsafe]
fn foo() int {
mut 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
}