add tests I forgot to add
This commit is contained in:
parent
627217fa55
commit
66856a39b3
2 changed files with 26 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
// error-pattern: copying a noncopyable value
|
||||
|
||||
fn to_lambda1(f: lambda(uint) -> uint) -> lambda(uint) -> uint {
|
||||
ret f;
|
||||
}
|
||||
|
||||
fn to_lambda2(b: block(uint) -> uint) -> lambda(uint) -> uint {
|
||||
ret to_lambda1({|x| b(x)});
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
14
src/test/run-pass/block-arg-used-as-lambda.rs
Normal file
14
src/test/run-pass/block-arg-used-as-lambda.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fn to_lambda(f: lambda(uint) -> uint) -> lambda(uint) -> uint {
|
||||
ret f;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: lambda(uint) -> uint = to_lambda({ |x| x * 2u });
|
||||
let y = to_lambda(x);
|
||||
|
||||
let x_r = x(22u);
|
||||
let y_r = y(x_r);
|
||||
|
||||
assert x_r == 44u;
|
||||
assert y_r == 88u;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue