authorgravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2015-12-03 13:26:49-07:00
committergravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2015-12-03 13:26:49-07:00
log137fe9925809a51ee6a17e8acb8968e1223f4881
tree5e701b172c3e41cea3a412e658938ce64bb31b88
parent09a78d6235957001e6b92ea9a83899b18a394ac1

test for separate scopes not colliding


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

test/run_tests.cpp+22
......@@ -287,6 +287,28 @@ export fn _start() -> unreachable {
287287 if (!true) { puts("BAD 2"); }
288288 if (!false) { puts("OK 2"); }
289289 exit(0);
290}
291 )SOURCE", "OK 1\nOK 2\n");
292
293 add_simple_case("separate block scopes", R"SOURCE(
294#link("c")
295extern {
296 fn puts(s: *const u8) -> i32;
297 fn exit(code: i32) -> unreachable;
298}
299
300export fn _start() -> unreachable {
301 if (true) {
302 let no_conflict = 5;
303 if (no_conflict == 5) { puts("OK 1"); }
304 }
305
306 let c = {
307 let no_conflict = 10;
308 no_conflict
309 };
310 if (c == 10) { puts("OK 2"); }
311 exit(0);
290312}
291313 )SOURCE", "OK 1\nOK 2\n");
292314}