gecko-dev/third_party/rust/futures/tests/mpsc-close.rs
Servo VCS Sync 0822921f3b No bug - Revendor rust dependencies
--HG--
rename : third_party/rust/rayon/tests/compile-fail-unstable/scope_join_bad.rs => third_party/rust/rayon/tests/compile-fail/scope_join_bad.rs
rename : third_party/rust/rayon/tests/run-pass-unstable/scope_join.rs => third_party/rust/rayon/tests/run-pass/scope_join.rs
2017-05-09 03:47:56 +00:00

25 lines
454 B
Rust

extern crate futures;
use std::thread;
use futures::{Sink, Stream, Future};
use futures::sync::mpsc::*;
#[test]
fn smoke() {
let (mut sender, receiver) = channel(1);
let t = thread::spawn(move ||{
loop {
match sender.send(42).wait() {
Ok(s) => sender = s,
Err(_) => break,
}
}
});
receiver.take(3).for_each(|_| Ok(())).wait().unwrap();
t.join().unwrap()
}