mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
22 lines
433 B
Zig
22 lines
433 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
test "fully anonymous struct" {
|
|
try check(.{
|
|
.int = @as(u32, 1234),
|
|
.float = @as(f64, 12.34),
|
|
.b = true,
|
|
.s = "hi",
|
|
});
|
|
}
|
|
|
|
fn check(args: anytype) !void {
|
|
try expect(args.int == 1234);
|
|
try expect(args.float == 12.34);
|
|
try expect(args.b);
|
|
try expect(args.s[0] == 'h');
|
|
try expect(args.s[1] == 'i');
|
|
}
|
|
|
|
// test
|