rust/src/test/run-pass/move-3.rs

22 lines
387 B
Rust
Raw Normal View History

2011-05-31 16:11:30 -07:00
use std;
import std::uint;
fn test(bool x, @tup(int, int, int) foo) -> int {
auto bar = foo;
let @tup(int,int,int) y;
if (x) {
y <- bar;
} else {
y = @tup(4,5,6);
}
ret y._1;
}
fn main() {
auto x = @tup(1,2,3);
for each (uint i in uint::range(0u, 10000u)) {
assert (test(true, x) == 2);
}
assert (test(false, x) == 5);
}