about summary refs log tree commit diff
path: root/src/test/run-pass/task-compare.rs
blob: be7f658eb1abfc2ed14e961d4ad4cb5a3d010879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
   A test case for issue #577, which also exposes #588
*/

// FIXME: This won't work until we can compare resources
// xfail-test

use std;
import task;
import task::join;
import comm;

fn child() { }

fn main() {
    // tasks
    let t1;
    let t2;

    let c1 = child, c2 = child;
    t1 = task::spawn_joinable(c1);
    t2 = task::spawn_joinable(c2);

    assert (t1 == t1);
    assert (t1 != t2);

    // ports
    let p1;
    let p2;

    p1 = comm::port::<int>();
    p2 = comm::port::<int>();

    assert (p1 == p1);
    assert (p1 != p2);

    // channels
    let c1 = comm::chan(p1);
    let c2 = comm::chan(p2);

    assert (c1 == c1);
    assert (c1 != c2);

    join(t1);
    join(t2);
}