about summary refs log tree commit diff
path: root/lang/zig/struct-default.zig
blob: 941d20139d128c6c2ad35f3bb3a4b439a84d3da8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
const expect = @import("std").testing.expect;

const Foo = struct {
    a: i32 = 1234,
    b: i32,
};

test "default struct initialization fields" {
    const x = Foo{ .b = 5 };
    expect(x.a + x.b == 1239);
}