From b40432c94924f1fd7fef7df403348742ee17af4d Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Wed, 18 Jan 2017 13:55:47 +0100 Subject: [PATCH] add test case for filter+count --- src/libcoretest/iter.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 99d31293053..05a674e05d5 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -191,6 +191,12 @@ fn test_iterator_enumerate_count() { assert_eq!(xs.iter().count(), 6); } +#[test] +fn test_iterator_filter_count() { + let xs = [0, 1, 2, 3, 4, 5, 6, 7, 8]; + assert_eq!(xs.iter().filter(|x| x % 2 == 0).count(), 5); +} + #[test] fn test_iterator_peekable() { let xs = vec![0, 1, 2, 3, 4, 5];