1use futures::executor::block_on;
2use futures::future::{err, ok, select_ok};
3
4#[test]
5fn ignore_err() {
6 let v = vec![err(1), err(2), ok(3), ok(4)];
7
8 let (i, v) = block_on(select_ok(v)).ok().unwrap();
9 assert_eq!(i, 3);
10
11 assert_eq!(v.len(), 1);
12
13 let (i, v) = block_on(select_ok(v)).ok().unwrap();
14 assert_eq!(i, 4);
15
16 assert!(v.is_empty());
17}
18
19#[test]
20fn last_err() {
21 let v = vec![ok(1), err(2), err(3)];
22
23 let (i, v) = block_on(select_ok(v)).ok().unwrap();
24 assert_eq!(i, 1);
25
26 assert_eq!(v.len(), 2);
27
28 let i = block_on(select_ok(v)).err().unwrap();
29 assert_eq!(i, 3);
30}
31