Skip to content

Commit 13f6cbf

Browse files
author
Markus Jais
committed
added test for filter_map function of streams
1 parent 8732802 commit 13f6cbf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/stream.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ fn adapters() {
6060
assert_done(|| list().fold(0, |a, b| finished::<i32, u32>(a + b)), Ok(6));
6161
assert_done(|| err_list().fold(0, |a, b| finished::<i32, u32>(a + b)), Err(3));
6262
assert_done(|| list().filter(|a| *a % 2 == 0).collect(), Ok(vec![2]));
63+
assert_done(|| list().filter_map(|x| {
64+
if x % 2 == 0 {
65+
Some(x + 10)
66+
} else {
67+
None
68+
}
69+
}).collect(), Ok(vec![12]));
6370
assert_done(|| list().and_then(|a| Ok(a + 1)).collect(), Ok(vec![2, 3, 4]));
6471
assert_done(|| list().then(|a| a.map(|e| e + 1)).collect(), Ok(vec![2, 3, 4]));
6572
assert_done(|| list().and_then(|a| failed::<i32, u32>(a as u32)).collect(),

0 commit comments

Comments
 (0)