mirror of
https://github.com/ziglang/zig.git
synced 2026-02-11 20:11:23 +00:00
add test for struct with var field
This commit is contained in:
parent
44b1dc6db8
commit
f7574f44c1
@ -777,3 +777,16 @@ test "anonymous struct literal assigned to variable" {
|
||||
vec.@"1" += 1;
|
||||
expect(vec.@"1" == 56);
|
||||
}
|
||||
|
||||
test "struct with var field" {
|
||||
const Point = struct {
|
||||
x: var,
|
||||
y: var,
|
||||
};
|
||||
const pt = Point {
|
||||
.x = 1,
|
||||
.y = 2,
|
||||
};
|
||||
expect(pt.x == 1);
|
||||
expect(pt.y == 2);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user