Skip to content

Commit 9fff8c6

Browse files
committed
std: add a test for HashMap::find_equiv.
1 parent efc71a8 commit 9fff8c6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/libstd/hashmap.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,23 @@ mod test_map {
866866
assert_eq!(m.len(), i);
867867
assert!(!m.is_empty());
868868
}
869+
870+
#[test]
871+
fn test_find_equiv() {
872+
let mut m = HashMap::new();
873+
874+
let (foo, bar, baz) = (1,2,3);
875+
m.insert(~"foo", foo);
876+
m.insert(~"bar", bar);
877+
m.insert(~"baz", baz);
878+
879+
880+
assert_eq!(m.find_equiv(&("foo")), Some(&foo));
881+
assert_eq!(m.find_equiv(&("bar")), Some(&bar));
882+
assert_eq!(m.find_equiv(&("baz")), Some(&baz));
883+
884+
assert_eq!(m.find_equiv(&("qux")), None);
885+
}
869886
}
870887

871888
#[cfg(test)]

0 commit comments

Comments
 (0)