| ... | @@ -103,7 +103,11 @@ test "basic extern unions" { | ... | @@ -103,7 +103,11 @@ test "basic extern unions" { |
| 103 | var foo = FooExtern{ .int = 1 }; | 103 | var foo = FooExtern{ .int = 1 }; |
| 104 | try expect(foo.int == 1); | 104 | try expect(foo.int == 1); |
| 105 | foo.str.slice = "Well"; | 105 | foo.str.slice = "Well"; |
| 106 | try expect(std.mem.eql(u8, std.mem.sliceTo(foo.str.slice, 0), "Well")); | 106 | try expect(foo.str.slice[0] == 'W'); |
| | 107 | try expect(foo.str.slice[1] == 'e'); |
| | 108 | try expect(foo.str.slice[2] == 'l'); |
| | 109 | try expect(foo.str.slice[3] == 'l'); |
| | 110 | try expect(foo.str.slice[4] == 0); |
| 107 | } | 111 | } |
| 108 | | 112 | |
| 109 | const ExternPtrOrInt = extern union { | 113 | const ExternPtrOrInt = extern union { |