1
Fork 0

Add some simple tests for move.

This commit is contained in:
Michael Sullivan 2011-05-31 15:30:34 -07:00 committed by Graydon Hoare
parent c232964301
commit 68b4688875
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,4 @@
fn main() {
auto x;
x <- 5;
}

View file

@ -0,0 +1,21 @@
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);
assert (test(true, x) == 2);
assert (test(true, x) == 2);
assert (test(true, x) == 2);
assert (test(false, x) == 5);
}