From b4090aa730640bc0dbd06a8ec5cf32b842c166e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Mon, 19 Jan 2015 15:36:07 +0100 Subject: [PATCH] Add test for #21328 --- src/libcollections/vec_map.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 93f3e192d6d5..7ff2e9535886 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -966,7 +966,19 @@ mod test_map { assert_eq!(v, box 2i); } assert!(called); - m.insert(2, box 1i); + } + + #[test] + fn test_drain_iterator() { + let mut map = VecMap::new(); + map.insert(1, "a"); + map.insert(3, "c"); + map.insert(2, "b"); + + let vec: Vec<(usize, &str)> = map.drain().collect(); + + assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]); + assert_eq!(map.len(), 0); } #[test]