test for separate scopes not colliding

This commit is contained in:
Josh Wolfe 2015-12-03 13:26:49 -07:00
parent 09a78d6235
commit 137fe99258

View file

@ -287,6 +287,28 @@ export fn _start() -> unreachable {
if (!true) { puts("BAD 2"); } if (!true) { puts("BAD 2"); }
if (!false) { puts("OK 2"); } if (!false) { puts("OK 2"); }
exit(0); 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"); )SOURCE", "OK 1\nOK 2\n");
} }