Add tests for Iterator::copied()
This commit is contained in:
parent
fcc46040a9
commit
fe45e9a886
@ -1232,6 +1232,23 @@ fn test_rev() {
|
||||
vec![16, 14, 12, 10, 8, 6]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_copied() {
|
||||
let xs = [2, 4, 6, 8];
|
||||
|
||||
let mut it = xs.iter().copied();
|
||||
assert_eq!(it.len(), 4);
|
||||
assert_eq!(it.next(), Some(2));
|
||||
assert_eq!(it.len(), 3);
|
||||
assert_eq!(it.next(), Some(4));
|
||||
assert_eq!(it.len(), 2);
|
||||
assert_eq!(it.next_back(), Some(8));
|
||||
assert_eq!(it.len(), 1);
|
||||
assert_eq!(it.next_back(), Some(6));
|
||||
assert_eq!(it.len(), 0);
|
||||
assert_eq!(it.next_back(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cloned() {
|
||||
let xs = [2, 4, 6, 8];
|
||||
|
@ -20,6 +20,7 @@
|
||||
#![feature(flt2dec)]
|
||||
#![feature(fmt_internals)]
|
||||
#![feature(hashmap_internals)]
|
||||
#![feature(iter_copied)]
|
||||
#![feature(iter_unfold)]
|
||||
#![feature(pattern)]
|
||||
#![feature(range_is_empty)]
|
||||
|
Loading…
Reference in New Issue
Block a user