mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
More tests for <-.
This commit is contained in:
parent
fd1029e6dd
commit
78b0d33c35
@ -1,4 +0,0 @@
|
||||
fn main() {
|
||||
auto x;
|
||||
x <- 5;
|
||||
}
|
@ -1,6 +1,3 @@
|
||||
use std;
|
||||
import std::uint;
|
||||
|
||||
fn test(bool x, @tup(int, int, int) foo) -> int {
|
||||
auto bar = foo;
|
||||
let @tup(int,int,int) y;
|
||||
|
5
src/test/run-pass/move-2.rs
Normal file
5
src/test/run-pass/move-2.rs
Normal file
@ -0,0 +1,5 @@
|
||||
fn main() {
|
||||
auto x = @tup(1,2,3);
|
||||
auto y <- x;
|
||||
assert (y._1 == 2);
|
||||
}
|
21
src/test/run-pass/move-3.rs
Normal file
21
src/test/run-pass/move-3.rs
Normal 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);
|
||||
for each (uint i in uint::range(0u, 10000u)) {
|
||||
assert (test(true, x) == 2);
|
||||
}
|
||||
assert (test(false, x) == 5);
|
||||
}
|
15
src/test/run-pass/move-4.rs
Normal file
15
src/test/run-pass/move-4.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use std;
|
||||
import std::uint;
|
||||
|
||||
fn test(@tup(int, int, int) foo) -> @tup(int, int, int) {
|
||||
auto bar <- foo;
|
||||
auto baz <- bar;
|
||||
auto quux <- baz;
|
||||
ret quux;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
auto x = @tup(1,2,3);
|
||||
auto y = test(x);
|
||||
assert (y._2 == 3);
|
||||
}
|
Loading…
Reference in New Issue
Block a user