Added a test case for #507
This commit is contained in:
parent
6e6bc5076c
commit
71e1db596c
1 changed files with 34 additions and 0 deletions
34
src/test/run-pass/issue-507.rs
Normal file
34
src/test/run-pass/issue-507.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
/*
|
||||
This is a test case for Issue 507.
|
||||
|
||||
https://github.com/graydon/rust/issues/507
|
||||
*/
|
||||
|
||||
use std;
|
||||
|
||||
import std::task::join;
|
||||
|
||||
fn grandchild(chan[int] c) {
|
||||
c <| 42;
|
||||
}
|
||||
|
||||
fn child(chan[int] c) {
|
||||
auto _grandchild = spawn grandchild(c);
|
||||
join(_grandchild);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let port[int] p = port();
|
||||
|
||||
auto _child = spawn child(chan(p));
|
||||
|
||||
let int x;
|
||||
p |> x;
|
||||
|
||||
log x;
|
||||
|
||||
assert(x == 42);
|
||||
|
||||
join(_child);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue