aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-23 00:07:08 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-23 00:07:08 -0700
commit1543043bf5b5633de485dccee88872a3d4f6c454 (patch)
tree98de24dfa20e440a5c201727c8bb87102694e131 /test/run_tests.cpp
parentbfceb186319f52011762129c879abbe27eaa0161 (diff)
downloadzig-1543043bf5b5633de485dccee88872a3d4f6c454.tar.gz
zig-1543043bf5b5633de485dccee88872a3d4f6c454.zip
fix no error emitted for redeclaring global var
closes #81
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index d4ff895351..fe8dc39ae0 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1484,6 +1484,21 @@ struct A { x : i32, }
struct A { y : i32, }
)SOURCE", 1, ".tmp_source.zig:3:1: error: redefinition of 'A'");
+ add_compile_fail_case("redefinition of enums", R"SOURCE(
+enum A {}
+enum A {}
+ )SOURCE", 1, ".tmp_source.zig:3:1: error: redefinition of 'A'");
+
+ add_compile_fail_case("redefinition of error values", R"SOURCE(
+%.A;
+%.A;
+ )SOURCE", 1, ".tmp_source.zig:3:1: error: redefinition of error 'A'");
+
+ add_compile_fail_case("redefinition of global variables", R"SOURCE(
+var a : i32 = 1;
+var a : i32 = 2;
+ )SOURCE", 1, ".tmp_source.zig:3:1: error: redeclaration of variable 'a'");
+
add_compile_fail_case("byvalue struct on exported functions", R"SOURCE(
struct A { x : i32, }
export fn f(a : A) => {}
@@ -1608,6 +1623,7 @@ extern {
}
const x = foo();
)SOURCE", 1, ".tmp_source.zig:5:11: error: global variable initializer requires constant expression");
+
}
static void print_compiler_invocation(TestCase *test_case) {