aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-22 18:05:22 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-22 18:05:22 -0700
commit1158bc3eadd8127301f96ecb9bcbb04cf04156b8 (patch)
tree8887fad0da5bc92e1098268ce9efe8617d950f67 /test/run_tests.cpp
parent7bd9c8238626998f8016086762483114e5c58f70 (diff)
downloadzig-1158bc3eadd8127301f96ecb9bcbb04cf04156b8.tar.gz
zig-1158bc3eadd8127301f96ecb9bcbb04cf04156b8.zip
support statically initialized structs
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 9150d96079..9a06deb2a9 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -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");
+
}