Skip to content

Commit

Permalink
Use assertions in find_with_or_insert_with example
Browse files Browse the repository at this point in the history
This lets us test it automatically and also makes it more obvious what
the expected result is.
  • Loading branch information
chris-morgan committed May 15, 2014
1 parent 73dc1e0 commit 5b13ddb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/libcollections/hashmap.rs
Expand Up @@ -1299,9 +1299,10 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
/// );
/// }
///
/// 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,
Expand Down

5 comments on commit 5b13ddb

@bors
Copy link
Contributor

@bors bors commented on 5b13ddb May 15, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from kballard
at chris-morgan@5b13ddb

@bors
Copy link
Contributor

@bors bors commented on 5b13ddb May 15, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging chris-morgan/rust/hashmap-mangle = 5b13ddb into auto

@bors
Copy link
Contributor

@bors bors commented on 5b13ddb May 15, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chris-morgan/rust/hashmap-mangle = 5b13ddb merged ok, testing candidate = 2a3515d2

@chris-morgan
Copy link
Member Author

@chris-morgan chris-morgan commented on 5b13ddb May 15, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.