about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorSamuel Chase <samebchase@gmail.com>2013-05-11 17:40:52 +0530
committerSamuel Chase <samebchase@gmail.com>2013-05-11 17:40:52 +0530
commit3c1e78788423f6036d370c4ea37718f3494868e7 (patch)
tree3ce0053e311ecf1cd941cd09d94e8279bbd015d3 /src/libcore
parentfd5a3520d5fbb009b2a5de8cf5ed164f28418cb1 (diff)
downloadrust-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.rs20
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