Add basic unit test for std::slice::Iter::as_slice.
This commit is contained in:
parent
3808dc3560
commit
dc22186efb
1 changed files with 9 additions and 0 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue