Iterator: Test that Iterator can be used in a for loop

`for x in foo` depends on foo implementing IntoIterator.
This commit is contained in:
Jan Alexander Steffens (heftig) 2019-09-05 11:01:16 +02:00
parent 7a12c4d5e1
commit 105412b5a0
No known key found for this signature in database
GPG key ID: DE5E0C5F25941CA5

View file

@ -767,6 +767,15 @@ mod tests {
assert_eq!(it.next(), None);
}
#[test]
fn test_into_iter() {
let mut v = vec![1i32, 2, 3].into_iter();
for x in Iterator::from_vec(vec![1i32, 2, 3]) {
assert_eq!(x.unwrap(), v.next().unwrap());
}
assert_eq!(v.next(), None);
}
#[test]
fn test_std_resync_collect() {
use prelude::*;