From 5b13ddb5f2da143f46240c5933fba2a035e68102 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Thu, 15 May 2014 10:28:48 +1000 Subject: [PATCH] Use assertions in find_with_or_insert_with example This lets us test it automatically and also makes it more obvious what the expected result is. --- src/libcollections/hashmap.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs index 35a89fe5dc5..87dc97d70c7 100644 --- a/src/libcollections/hashmap.rs +++ b/src/libcollections/hashmap.rs @@ -1299,9 +1299,10 @@ impl, V, S, H: Hasher> HashMap { /// ); /// } /// - /// for (k, v) in map.iter() { - /// println!("{} -> {}", *k, *v); - /// } + /// assert_eq!(map.len(), 3); + /// assert_eq!(map.get(&"a key"), &vec!["value", "new value"]); + /// assert_eq!(map.get(&"b key"), &vec!["new value"]); + /// assert_eq!(map.get(&"z key"), &vec!["new value", "value"]); /// ``` pub fn find_with_or_insert_with<'a, A>(&'a mut self, k: K,