aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/test_namespaced_container_level_variable.zig
blob: 22f56d7d1353cf5e3e7f7e29c154baeefd558d3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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