Add another test for blocks as expressions
This commit is contained in:
parent
19a949c15e
commit
c27b72e323
1 changed files with 31 additions and 0 deletions
31
src/test/run-pass/expr-block.rs
Normal file
31
src/test/run-pass/expr-block.rs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// xfail-boot
|
||||||
|
// -*- rust -*-
|
||||||
|
|
||||||
|
// Tests for standalone blocks as expressions
|
||||||
|
|
||||||
|
fn test_basic() {
|
||||||
|
let bool res = { true };
|
||||||
|
check (res);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_rec() {
|
||||||
|
auto res = { rec(v1 = 10, v2 = 20) };
|
||||||
|
check (res.v2 == 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_filled_with_stuff() {
|
||||||
|
auto res = {
|
||||||
|
auto a = 0;
|
||||||
|
while (a < 10) {
|
||||||
|
a += 1;
|
||||||
|
}
|
||||||
|
a
|
||||||
|
};
|
||||||
|
check (res == 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
test_basic();
|
||||||
|
test_rec();
|
||||||
|
test_filled_with_stuff();
|
||||||
|
}
|
Loading…
Reference in a new issue