summaryrefslogtreecommitdiffstats
path: root/third_party/rust/futures-0.1.31/tests/recurse.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/rust/futures-0.1.31/tests/recurse.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/third_party/rust/futures-0.1.31/tests/recurse.rs b/third_party/rust/futures-0.1.31/tests/recurse.rs
new file mode 100644
index 0000000000..a521ed13b7
--- /dev/null
+++ b/third_party/rust/futures-0.1.31/tests/recurse.rs
@@ -0,0 +1,25 @@
+#![allow(bare_trait_objects, unknown_lints)]
+
+extern crate futures;
+
+use std::sync::mpsc::channel;
+
+use futures::future::ok;
+use futures::prelude::*;
+
+#[test]
+fn lots() {
+ fn doit(n: usize) -> Box<Future<Item=(), Error=()> + Send> {
+ if n == 0 {
+ Box::new(ok(()))
+ } else {
+ Box::new(ok(n - 1).and_then(doit))
+ }
+ }
+
+ let (tx, rx) = channel();
+ ::std::thread::spawn(|| {
+ doit(1_000).map(move |_| tx.send(()).unwrap()).wait()
+ });
+ rx.recv().unwrap();
+}