Skip to content

Commit 68b4688

Browse files
msullivangraydon
authored andcommitted
Add some simple tests for move.
1 parent c232964 commit 68b4688

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn main() {
2+
auto x;
3+
x <- 5;
4+
}

src/test/run-pass/move-1.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use std;
2+
import std::uint;
3+
4+
fn test(bool x, @tup(int, int, int) foo) -> int {
5+
auto bar = foo;
6+
let @tup(int,int,int) y;
7+
if (x) {
8+
y <- bar;
9+
} else {
10+
y = @tup(4,5,6);
11+
}
12+
ret y._1;
13+
}
14+
15+
fn main() {
16+
auto x = @tup(1,2,3);
17+
assert (test(true, x) == 2);
18+
assert (test(true, x) == 2);
19+
assert (test(true, x) == 2);
20+
assert (test(false, x) == 5);
21+
}

0 commit comments

Comments
 (0)