Add drain_filter_unconsumed test
This commit is contained in:
parent
17a517a42a
commit
53d46ae96e
1 changed files with 8 additions and 0 deletions
|
@ -1044,6 +1044,14 @@ fn drain_filter_unconsumed_panic() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drain_filter_unconsumed() {
|
||||
let mut vec = vec![1, 2, 3, 4];
|
||||
let drain = vec.drain_filter(|&mut x| x % 2 != 0);
|
||||
drop(drain);
|
||||
assert_eq!(vec, [2, 4]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reserve_exact() {
|
||||
// This is all the same as test_reserve
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue