authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-12-24 13:49:23-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-12-24 13:49:23-07:00
log2e74889c3ce61aae8e9e461d1f49a9b5cb79edc2
tree394f6ebea89ad9f2dca96c9703b41fec2a6e443c
parent08a7ce7dd5f348b37bf98c5040ad58720a7818b5

add test for invalid field in struct value expression


1 files changed, 15 insertions(+), 0 deletions(-)

test/run_tests.cpp+15
......@@ -907,6 +907,21 @@ fn f() {
907907 };
908908}
909909 )SOURCE", 1, ".tmp_source.zig:8:15: error: missing field: 'x'");
910
911 add_compile_fail_case("invalid field in struct value expression", R"SOURCE(
912struct A {
913 x : i32,
914 y : i32,
915 z : i32,
916}
917fn f() {
918 const a = A {
919 .z = 4,
920 .y = 2,
921 .foo = 42,
922 };
923}
924 )SOURCE", 1, ".tmp_source.zig:11:9: error: no member named 'foo' in 'A'");
910925}
911926
912927static void print_compiler_invocation(TestCase *test_case) {