1 extern crate futures;
2
3 use futures::future::*;
4
5 #[test]
ignore_err()6 fn ignore_err() {
7 let v = vec![
8 err(1),
9 err(2),
10 ok(3),
11 ok(4),
12 ];
13
14 let (i, v) = select_ok(v).wait().ok().unwrap();
15 assert_eq!(i, 3);
16
17 assert_eq!(v.len(), 1);
18
19 let (i, v) = select_ok(v).wait().ok().unwrap();
20 assert_eq!(i, 4);
21
22 assert!(v.is_empty());
23 }
24
25 #[test]
last_err()26 fn last_err() {
27 let v = vec![
28 ok(1),
29 err(2),
30 err(3),
31 ];
32
33 let (i, v) = select_ok(v).wait().ok().unwrap();
34 assert_eq!(i, 1);
35
36 assert_eq!(v.len(), 2);
37
38 let i = select_ok(v).wait().err().unwrap();
39 assert_eq!(i, 3);
40 }
41