1 use futures::{
2 stream::{self, StreamExt, TryStreamExt},
3 task::Poll,
4 };
5 use futures_test::task::noop_context;
6
7 #[test]
try_filter_map_after_err()8 fn try_filter_map_after_err() {
9 let cx = &mut noop_context();
10 let mut s = stream::iter(1..=3)
11 .map(Ok)
12 .try_filter_map(|v| async move { Err::<Option<()>, _>(v) })
13 .filter_map(|r| async move { r.ok() })
14 .boxed();
15 assert_eq!(Poll::Ready(None), s.poll_next_unpin(cx));
16 }
17
18 #[test]
try_skip_while_after_err()19 fn try_skip_while_after_err() {
20 let cx = &mut noop_context();
21 let mut s = stream::iter(1..=3)
22 .map(Ok)
23 .try_skip_while(|_| async move { Err::<_, ()>(()) })
24 .filter_map(|r| async move { r.ok() })
25 .boxed();
26 assert_eq!(Poll::Ready(None), s.poll_next_unpin(cx));
27 }
28
29 #[test]
try_take_while_after_err()30 fn try_take_while_after_err() {
31 let cx = &mut noop_context();
32 let mut s = stream::iter(1..=3)
33 .map(Ok)
34 .try_take_while(|_| async move { Err::<_, ()>(()) })
35 .filter_map(|r| async move { r.ok() })
36 .boxed();
37 assert_eq!(Poll::Ready(None), s.poll_next_unpin(cx));
38 }
39