aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/expr-block.rs
blob: 1c03a6b0694af4e27c8fd62416541982c8954a98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// xfail-boot
// -*- rust -*-

// Tests for standalone blocks as expressions

fn test_basic() {
  let bool res = { true };
  assert (res);
}

fn test_rec() {
  auto res = { rec(v1 = 10, v2 = 20) };
  assert (res.v2 == 20);
}

fn test_filled_with_stuff() {
  auto res = {
    auto a = 0;
    while (a < 10) {
      a += 1;
    }
    a
  };
  assert (res == 10);
}

fn main() {
  test_basic();
  test_rec();
  test_filled_with_stuff();
}