add test for struct with var field
1 files changed, 13 insertions(+), 0 deletions(-)
test/stage1/behavior/struct.zig+13
| ... | ... | @@ -777,3 +777,16 @@ test "anonymous struct literal assigned to variable" { |
| 777 | 777 | vec.@"1" += 1; |
| 778 | 778 | expect(vec.@"1" == 56); |
| 779 | 779 | } |
| 780 | |
| 781 | test "struct with var field" { |
| 782 | const Point = struct { |
| 783 | x: var, |
| 784 | y: var, |
| 785 | }; |
| 786 | const pt = Point { |
| 787 | .x = 1, |
| 788 | .y = 2, |
| 789 | }; |
| 790 | expect(pt.x == 1); |
| 791 | expect(pt.y == 2); |
| 792 | } |