Skip to content

Commit b4090aa

Browse files
committed
Add test for #21328
1 parent c3ac929 commit b4090aa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/libcollections/vec_map.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,19 @@ mod test_map {
966966
assert_eq!(v, box 2i);
967967
}
968968
assert!(called);
969-
m.insert(2, box 1i);
969+
}
970+
971+
#[test]
972+
fn test_drain_iterator() {
973+
let mut map = VecMap::new();
974+
map.insert(1, "a");
975+
map.insert(3, "c");
976+
map.insert(2, "b");
977+
978+
let vec: Vec<(usize, &str)> = map.drain().collect();
979+
980+
assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
981+
assert_eq!(map.len(), 0);
970982
}
971983

972984
#[test]

0 commit comments

Comments
 (0)