diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-11 20:33:30 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-12 12:21:04 +1000 |
| commit | 9fff8c6eba287e0ed7cce6014dc58482afe425b0 (patch) | |
| tree | e78d8b59b3c72a49e5b15721257e42b242d4db37 /src/libstd | |
| parent | efc71a8bdb28fba88d0cc8916b33838bf43b3a8d (diff) | |
| download | rust-9fff8c6eba287e0ed7cce6014dc58482afe425b0.tar.gz rust-9fff8c6eba287e0ed7cce6014dc58482afe425b0.zip | |
std: add a test for HashMap::find_equiv.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/hashmap.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs index 7a9435d2ecd..c0cc92723ba 100644 --- a/src/libstd/hashmap.rs +++ b/src/libstd/hashmap.rs @@ -866,6 +866,23 @@ mod test_map { assert_eq!(m.len(), i); assert!(!m.is_empty()); } + + #[test] + fn test_find_equiv() { + let mut m = HashMap::new(); + + let (foo, bar, baz) = (1,2,3); + m.insert(~"foo", foo); + m.insert(~"bar", bar); + m.insert(~"baz", baz); + + + assert_eq!(m.find_equiv(&("foo")), Some(&foo)); + assert_eq!(m.find_equiv(&("bar")), Some(&bar)); + assert_eq!(m.find_equiv(&("baz")), Some(&baz)); + + assert_eq!(m.find_equiv(&("qux")), None); + } } #[cfg(test)] |
