mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 09:02:32 +00:00
19 lines
276 B
Zig
19 lines
276 B
Zig
|
const std = @import("std");
|
||
|
const expect = std.testing.expect;
|
||
|
|
||
|
test "namespaced container level variable" {
|
||
|
try expect(foo() == 1235);
|
||
|
try expect(foo() == 1236);
|
||
|
}
|
||
|
|
||
|
const S = struct {
|
||
|
var x: i32 = 1234;
|
||
|
};
|
||
|
|
||
|
fn foo() i32 {
|
||
|
S.x += 1;
|
||
|
return S.x;
|
||
|
}
|
||
|
|
||
|
// test
|