rust/src/test/run-pass/expr-alt-box.rs

17 lines
310 B
Rust
Raw Normal View History

2011-04-02 18:32:34 -05:00
// -*- rust -*-
// Tests for alt as expressions resulting in boxed types
fn test_box() {
auto rs = alt (true) { case (true) { @100 } };
assert (*rs == 100);
2011-04-02 18:32:34 -05:00
}
fn test_str() {
auto rs = alt (true) { case (true) { "happy" } };
assert (rs == "happy");
2011-04-02 18:32:34 -05:00
}
fn main() { test_box(); test_str(); }