diff options
| author | Samuel Chase <samebchase@gmail.com> | 2013-05-11 17:40:52 +0530 |
|---|---|---|
| committer | Samuel Chase <samebchase@gmail.com> | 2013-05-11 17:40:52 +0530 |
| commit | 3c1e78788423f6036d370c4ea37718f3494868e7 (patch) | |
| tree | 3ce0053e311ecf1cd941cd09d94e8279bbd015d3 /src/libcore | |
| parent | fd5a3520d5fbb009b2a5de8cf5ed164f28418cb1 (diff) | |
| download | rust-3c1e78788423f6036d370c4ea37718f3494868e7.tar.gz rust-3c1e78788423f6036d370c4ea37718f3494868e7.zip | |
All tests, including newly added test_hashmap() pass. The empty Hash Table doesn't need to be mutable.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/to_str.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index d3e3d8348b1..a54bb7e94a2 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -175,15 +175,17 @@ mod tests { ~"[[], [1], [1, 1]]"); } - // #[test] - // fn test_hashmap() { - // let mut table: HashMap<int, int> = HashMap::new(); - // let mut empty: HashMap<int, int> = HashMap::new(); + #[test] + fn test_hashmap() { + let mut table: HashMap<int, int> = HashMap::new(); + let empty: HashMap<int, int> = HashMap::new(); + + table.insert(3, 4); + table.insert(1, 2); - // table.insert(3, 4); - // table.insert(1, 2); + let table_str = table.to_str(); - // assert!(table.to_str() == ~"{1 : 2, 3 : 4}"); - // assert!(empty.to_str() == ~"{}"); - //} + assert!(table_str == ~"{1 : 2, 3 : 4}" || table_str == ~"{3 : 4, 1 : 2}"); + assert!(empty.to_str() == ~"{}"); + } } \ No newline at end of file |
