| 1 | const std = @import("std"); |
| 2 | const expectEqual = std.testing.expectEqual; |
| 3 | |
| 4 | test "static local variable" { |
| 5 | try expectEqual(1235, foo()); |
| 6 | try expectEqual(1236, foo()); |
| 7 | } |
| 8 | |
| 9 | fn foo() i32 { |
| 10 | const S = struct { |
| 11 | var x: i32 = 1234; |
| 12 | }; |
| 13 | S.x += 1; |
| 14 | return S.x; |
| 15 | } |
| 16 | |
| 17 | // test |