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