rust/src/test/run-pass/expr-alt-box.rs
Marijn Haverbeke 9561def209 Use 'resource' rather than 'res' as a keyword
Resources are now defined like...

    resource fd(int n) { close(n); }

Calling fd with an int will then produce a non-copyable value
that, when dropped, will call close on the given int.
2011-06-28 18:00:39 +02:00

17 lines
314 B
Rust

// -*- rust -*-
// Tests for alt as expressions resulting in boxed types
fn test_box() {
auto res = alt (true) { case (true) { @100 } };
assert (*res == 100);
}
fn test_str() {
auto res = alt (true) { case (true) { "happy" } };
assert (res == "happy");
}
fn main() { test_box(); test_str(); }