Skip to content

Commit 65e65e3

Browse files
authored
Merge pull request #74 from MarkusJais/master
added test for filter_map function of streams
2 parents 8732802 + 13f6cbf commit 65e65e3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/stream.rs

+7
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)