Skip to content

Commit d3a2a3d

Browse files
authored
Merge pull request #623 from cppbear/add-tests
Add test for HashMap::get_mut with non-existent key
2 parents 165fdcf + e52627b commit d3a2a3d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/map.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5058,6 +5058,10 @@ mod test_map {
50585058
Some(x) => *x = new,
50595059
}
50605060
assert_eq!(m.get(&5), Some(&new));
5061+
let mut hashmap: HashMap<i32, String> = HashMap::default();
5062+
let key = &1;
5063+
let result = hashmap.get_mut(key);
5064+
assert!(result.is_none());
50615065
}
50625066

50635067
#[test]

0 commit comments

Comments
 (0)