提交 e9e799f7 编写于 作者: E Erick Tryzelaar

collections: add Show impl test for HashMap

上级 85d9cfb8
......@@ -2003,6 +2003,20 @@ fn test_eq() {
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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册