Skip to content

Commit

Permalink
add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed May 18, 2021
1 parent 60a900e commit a44a059
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions library/alloc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,18 @@ fn test_from_iter_specialization_panic_during_drop_leaks() {
}
}

// regression test for issue #85322. Peekable previously implemented InPlaceIterable,
// but due to an interaction with IntoIter's current Clone implementation it failed to uphold
// the contract.
#[test]
fn test_collect_after_iterator_clone() {
let v = vec![0; 5];
let mut i = v.into_iter().peekable();
i.peek();
let v = i.clone().collect::<Vec<_>>();
assert!(v.len() <= v.capacity());
}

#[test]
fn test_cow_from() {
let borrowed: &[_] = &["borrowed", "(slice)"];
Expand Down

0 comments on commit a44a059

Please sign in to comment.