aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/v/tests/static_vars_test.v
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/old/vlib/v/tests/static_vars_test.v')
-rw-r--r--v_windows/v/old/vlib/v/tests/static_vars_test.v16
1 files changed, 16 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/v/tests/static_vars_test.v b/v_windows/v/old/vlib/v/tests/static_vars_test.v
new file mode 100644
index 0000000..030b086
--- /dev/null
+++ b/v_windows/v/old/vlib/v/tests/static_vars_test.v
@@ -0,0 +1,16 @@
+[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
+}