collections: add Show impl test for HashMap
This commit is contained in:
parent
85d9cfb809
commit
e9e799f750
1 changed files with 14 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue