collections: add Show impl test for HashMap

This commit is contained in:
Erick Tryzelaar 2014-05-26 15:20:39 -07:00
parent 85d9cfb809
commit e9e799f750

View File

@ -2003,6 +2003,20 @@ mod test_map {
assert_eq!(m1, m2);
}
#[test]
fn test_show() {
let mut map: HashMap<int, int> = HashMap::new();
let empty: HashMap<int, int> = HashMap::new();
map.insert(1, 2);
map.insert(3, 4);
let map_str = format!("{}", map);
assert!(map_str == "{1: 2, 3: 4}".to_owned() || map_str == "{3: 4, 1: 2}".to_owned());
assert_eq!(format!("{}", empty), "{}".to_owned());
}
#[test]
fn test_expand() {
let mut m = HashMap::new();