PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/task-compare.rs

http://github.com/jruderman/rust
Rust | 46 lines | 26 code | 12 blank | 8 comment | 6 complexity | 1417fdf7b96b15391af21a358d1b3ad3 MD5 | raw file
 1/**
 2   A test case for issue #577, which also exposes #588
 3*/
 4
 5// FIXME: This won't work until we can compare resources (#2601)
 6// xfail-test
 7
 8use std;
 9import task;
10import task::join;
11import comm;
12
13fn child() { }
14
15fn main() {
16    // tasks
17    let t1;
18    let t2;
19
20    let c1 = child, c2 = child;
21    t1 = task::spawn_joinable(c1);
22    t2 = task::spawn_joinable(c2);
23
24    assert (t1 == t1);
25    assert (t1 != t2);
26
27    // ports
28    let p1;
29    let p2;
30
31    p1 = comm::port::<int>();
32    p2 = comm::port::<int>();
33
34    assert (p1 == p1);
35    assert (p1 != p2);
36
37    // channels
38    let c1 = comm::chan(p1);
39    let c2 = comm::chan(p2);
40
41    assert (c1 == c1);
42    assert (c1 != c2);
43
44    join(t1);
45    join(t2);
46}