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

47 lines
659 B
Rust
Raw Normal View History

/**
A test case for issue #577, which also exposes #588
*/
use std;
2011-08-12 20:34:19 -05:00
import std::task;
import std::task::join_id;
import std::comm;
2011-07-27 07:19:39 -05:00
fn child() { }
fn main() {
// tasks
2011-07-27 07:19:39 -05:00
let t1;
let t2;
let c1 = child, c2 = child;
t1 = task::_spawn(c1);
t2 = task::_spawn(c2);
2011-07-27 07:19:39 -05:00
assert (t1 == t1);
assert (t1 != t2);
// ports
2011-07-27 07:19:39 -05:00
let p1;
let p2;
p1 = comm::mk_port::<int>();
p2 = comm::mk_port::<int>();
2011-07-27 07:19:39 -05:00
assert (p1 == p1);
assert (p1 != p2);
// channels
2011-07-27 07:19:39 -05:00
let c1;
let c2;
2011-08-12 20:34:19 -05:00
c1 = p1.mk_chan();
c2 = p2.mk_chan();
2011-07-27 07:19:39 -05:00
assert (c1 == c1);
assert (c1 != c2);
2011-08-12 20:34:19 -05:00
join_id(t1);
join_id(t2);
}