summaryrefslogtreecommitdiffstats
path: root/third_party/rust/futures-0.1.31/tests/select_all.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/futures-0.1.31/tests/select_all.rs')
-rw-r--r--third_party/rust/futures-0.1.31/tests/select_all.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/third_party/rust/futures-0.1.31/tests/select_all.rs b/third_party/rust/futures-0.1.31/tests/select_all.rs
new file mode 100644
index 0000000000..7780aa306d
--- /dev/null
+++ b/third_party/rust/futures-0.1.31/tests/select_all.rs
@@ -0,0 +1,27 @@
+extern crate futures;
+
+use futures::prelude::*;
+use futures::future::{ok, select_all, err};
+
+#[test]
+fn smoke() {
+ let v = vec![
+ ok(1),
+ err(2),
+ ok(3),
+ ];
+
+ let (i, idx, v) = select_all(v).wait().ok().unwrap();
+ assert_eq!(i, 1);
+ assert_eq!(idx, 0);
+
+ let (i, idx, v) = select_all(v).wait().err().unwrap();
+ assert_eq!(i, 2);
+ assert_eq!(idx, 0);
+
+ let (i, idx, v) = select_all(v).wait().ok().unwrap();
+ assert_eq!(i, 3);
+ assert_eq!(idx, 0);
+
+ assert!(v.is_empty());
+}