aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorJosh Wolfe <thejoshwolfe@gmail.com>2015-12-03 13:26:49 -0700
committerJosh Wolfe <thejoshwolfe@gmail.com>2015-12-03 13:26:49 -0700
commit137fe9925809a51ee6a17e8acb8968e1223f4881 (patch)
tree5e701b172c3e41cea3a412e658938ce64bb31b88 /test/run_tests.cpp
parent09a78d6235957001e6b92ea9a83899b18a394ac1 (diff)
downloadzig-137fe9925809a51ee6a17e8acb8968e1223f4881.tar.gz
zig-137fe9925809a51ee6a17e8acb8968e1223f4881.zip
test for separate scopes not colliding
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 875e2b94ff..3f5dd6d69c 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -289,6 +289,28 @@ export fn _start() -> unreachable {
exit(0);
}
)SOURCE", "OK 1\nOK 2\n");
+
+ add_simple_case("separate block scopes", R"SOURCE(
+#link("c")
+extern {
+ fn puts(s: *const u8) -> i32;
+ fn exit(code: i32) -> unreachable;
+}
+
+export fn _start() -> unreachable {
+ if (true) {
+ let no_conflict = 5;
+ if (no_conflict == 5) { puts("OK 1"); }
+ }
+
+ let c = {
+ let no_conflict = 10;
+ no_conflict
+ };
+ if (c == 10) { puts("OK 2"); }
+ exit(0);
+}
+ )SOURCE", "OK 1\nOK 2\n");
}
static void add_compile_failure_test_cases(void) {