Skip to content

Commit dc22186

Browse files
committed
Add basic unit test for std::slice::Iter::as_slice.
1 parent 3808dc3 commit dc22186

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/libcollectionstest/slice.rs

+9
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,15 @@ fn test_iter_size_hints() {
645645
assert_eq!(xs.iter_mut().size_hint(), (5, Some(5)));
646646
}
647647

648+
#[test]
649+
fn test_iter_as_slice() {
650+
let xs = [1, 2, 5, 10, 11];
651+
let mut iter = xs.iter();
652+
assert_eq!(iter.as_slice(), &[1, 2, 5, 10, 11]);
653+
iter.next();
654+
assert_eq!(iter.as_slice(), &[2, 5, 10, 11]);
655+
}
656+
648657
#[test]
649658
fn test_iter_as_ref() {
650659
let xs = [1, 2, 5, 10, 11];

0 commit comments

Comments
 (0)