rust/src/test/run-pass/expr-if-box.rs
Patrick Walton 147a2d655f Un-revert "Use different syntax for checks that matter to typestate", fixing the problem.
This reverts commit d08b443fffb1181d8d45ae5d061412f202dd4118.
2011-05-02 17:50:46 -07:00

20 lines
314 B
Rust

// xfail-boot
// -*- rust -*-
// Tests for if as expressions returning boxed types
fn test_box() {
auto res = if (true) { @100 } else { @101 };
assert (*res == 100);
}
fn test_str() {
auto res = if (true) { "happy" } else { "sad" };
assert (res == "happy");
}
fn main() {
test_box();
test_str();
}