mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
17 lines
273 B
Zig
17 lines
273 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
test "static local variable" {
|
|
try expect(foo() == 1235);
|
|
try expect(foo() == 1236);
|
|
}
|
|
|
|
fn foo() i32 {
|
|
const S = struct {
|
|
var x: i32 = 1234;
|
|
};
|
|
S.x += 1;
|
|
return S.x;
|
|
}
|
|
|
|
// test
|