Skip to content

Commit

Permalink
Add basic unit test for std::slice::Iter::as_slice.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Aug 16, 2016
1 parent 3808dc3 commit dc22186
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libcollectionstest/slice.rs
Expand Up @@ -645,6 +645,15 @@ fn test_iter_size_hints() {
assert_eq!(xs.iter_mut().size_hint(), (5, Some(5)));
}

#[test]
fn test_iter_as_slice() {
let xs = [1, 2, 5, 10, 11];
let mut iter = xs.iter();
assert_eq!(iter.as_slice(), &[1, 2, 5, 10, 11]);
iter.next();
assert_eq!(iter.as_slice(), &[2, 5, 10, 11]);
}

#[test]
fn test_iter_as_ref() {
let xs = [1, 2, 5, 10, 11];
Expand Down

0 comments on commit dc22186

Please sign in to comment.