From 1543043bf5b5633de485dccee88872a3d4f6c454 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 23 Jan 2016 00:07:08 -0700 Subject: fix no error emitted for redeclaring global var closes #81 --- test/run_tests.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/run_tests.cpp') 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) { -- cgit v1.2.3