]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/expr-if-box.rs
Use different syntax for checks that matter to typestate
[rust.git] / src / test / run-pass / expr-if-box.rs
1 // xfail-boot
2 // -*- rust -*-
3
4 // Tests for if as expressions returning boxed types
5
6 fn test_box() {
7   auto res = if (true) { @100 } else { @101 };
8   assert (*res == 100);
9 }
10
11 fn test_str() {
12   auto res = if (true) { "happy" } else { "sad" };
13   assert (res == "happy");
14 }
15
16 fn main() {
17   test_box();
18   test_str();
19 }