Add tests for ManagedMap::get.

This commit is contained in:
Valentin Lorentz 2018-05-17 06:44:19 +02:00 committed by whitequark
parent db40149779
commit cea6d52b0c

View File

@ -370,12 +370,31 @@ mod test {
assert_eq!(map.get("d"), Some(&4));
}
#[test]
fn test_get_some_one_pair() {
let mut pairs = one_pair_full();
let map = ManagedMap::Borrowed(&mut pairs);
assert_eq!(map.len(), 1);
assert_eq!(map.get("a"), Some(&1));
}
#[test]
fn test_get_none_full() {
let mut pairs = all_pairs_full();
let map = ManagedMap::Borrowed(&mut pairs);
assert_eq!(map.len(), 4);
assert!(!map.is_empty());
assert_eq!(map.get("q"), None);
assert_eq!(map.get("0"), None);
}
#[test]
fn test_get_none() {
let mut pairs = one_pair_full();
let map = ManagedMap::Borrowed(&mut pairs);
assert_eq!(map.len(), 1);
assert!(!map.is_empty());
assert_eq!(map.get("0"), None);
assert_eq!(map.get("q"), None);
}