Skip to content

Commit c27b72e

Browse files
committed
Add another test for blocks as expressions
1 parent 19a949c commit c27b72e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/test/run-pass/expr-block.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// xfail-boot
2+
// -*- rust -*-
3+
4+
// Tests for standalone blocks as expressions
5+
6+
fn test_basic() {
7+
let bool res = { true };
8+
check (res);
9+
}
10+
11+
fn test_rec() {
12+
auto res = { rec(v1 = 10, v2 = 20) };
13+
check (res.v2 == 20);
14+
}
15+
16+
fn test_filled_with_stuff() {
17+
auto res = {
18+
auto a = 0;
19+
while (a < 10) {
20+
a += 1;
21+
}
22+
a
23+
};
24+
check (res == 10);
25+
}
26+
27+
fn main() {
28+
test_basic();
29+
test_rec();
30+
test_filled_with_stuff();
31+
}

0 commit comments

Comments
 (0)