support statically initialized structs

This commit is contained in:
Andrew Kelley
2016-01-22 18:05:22 -07:00
parent 7bd9c82386
commit 1158bc3ead
4 changed files with 79 additions and 33 deletions

View File

@@ -1226,6 +1226,24 @@ pub fn main(args: [][]u8) i32 => {
}
)SOURCE", "OK\n");
add_simple_case("statically initialized struct", R"SOURCE(
import "std.zig";
struct Foo {
x: i32,
y: bool,
}
var foo = Foo { .x = 13, .y = true, };
pub fn main(args: [][]u8) i32 => {
foo.x += 1;
if (foo.x != 14) {
print_str("BAD\n");
}
print_str("OK\n");
return 0;
}
)SOURCE", "OK\n");
}