aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/expr-alt-struct.rs
blob: 762303d53c17eac3ce7a9af8159dd0c79f71c254 (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
32
33
34
35
// xfail-boot
// -*- rust -*-

// Tests for alt as expressions resulting in structural types

fn test_rec() {
  auto res = alt (true) {
    case (true) {
      rec(i = 100)
    }
  };
  assert (res == rec(i = 100));
}

fn test_tag() {
  tag mood {
    happy;
    sad;
  }

  auto res = alt (true) {
    case (true) {
      happy
    }
    case (false) {
      sad
    }
  };
  assert (res == happy);
}

fn main() {
  test_rec();
  test_tag();
}