PageRenderTime 15ms CodeModel.GetById 2ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/src/test/run-pass/task-comm-0.rs

http://github.com/jruderman/rust
Rust | 29 lines | 25 code | 4 blank | 0 comment | 1 complexity | 751057754e4bd4b91efe5d9e607ddee5 MD5 | raw file
 1use std;
 2
 3import pipes;
 4import pipes::chan;
 5import pipes::port;
 6import task;
 7
 8fn main() { test05(); }
 9
10fn test05_start(ch : chan<int>) {
11    ch.send(10);
12    error!{"sent 10"};
13    ch.send(20);
14    error!{"sent 20"};
15    ch.send(30);
16    error!{"sent 30"};
17}
18
19fn test05() {
20    let (ch, po) = pipes::stream();
21    task::spawn(|| test05_start(ch) );
22    let mut value = po.recv();
23    log(error, value);
24    value = po.recv();
25    log(error, value);
26    value = po.recv();
27    log(error, value);
28    assert (value == 30);
29}