blob: 824f72f0ba6ac0f7b96ef9dfc4f88ebae9da7943 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// -*- rust -*-
// Tests for if as expressions returning structural types
fn test_rec() {
auto rs = if (true) { rec(i=100) } else { rec(i=101) };
assert (rs == rec(i=100));
}
fn test_tag() {
tag mood { happy; sad; }
auto rs = if (true) { happy } else { sad };
assert (rs == happy);
}
fn main() { test_rec(); test_tag(); }
|