aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-24 13:49:23 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-24 13:49:23 -0700
commit2e74889c3ce61aae8e9e461d1f49a9b5cb79edc2 (patch)
tree394f6ebea89ad9f2dca96c9703b41fec2a6e443c /test/run_tests.cpp
parent08a7ce7dd5f348b37bf98c5040ad58720a7818b5 (diff)
downloadzig-2e74889c3ce61aae8e9e461d1f49a9b5cb79edc2.tar.gz
zig-2e74889c3ce61aae8e9e461d1f49a9b5cb79edc2.zip
add test for invalid field in struct value expression
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index f6a3c3dfec..9df3951979 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -907,6 +907,21 @@ fn f() {
};
}
)SOURCE", 1, ".tmp_source.zig:8:15: error: missing field: 'x'");
+
+ add_compile_fail_case("invalid field in struct value expression", R"SOURCE(
+struct A {
+ x : i32,
+ y : i32,
+ z : i32,
+}
+fn f() {
+ const a = A {
+ .z = 4,
+ .y = 2,
+ .foo = 42,
+ };
+}
+ )SOURCE", 1, ".tmp_source.zig:11:9: error: no member named 'foo' in 'A'");
}
static void print_compiler_invocation(TestCase *test_case) {