Skip to content

Commit 3c1e787

Browse files
committed
All tests, including newly added test_hashmap() pass. The empty Hash Table doesn't need to be mutable.
1 parent fd5a352 commit 3c1e787

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/libcore/to_str.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,17 @@ mod tests {
175175
~"[[], [1], [1, 1]]");
176176
}
177177
178-
// #[test]
179-
// fn test_hashmap() {
180-
// let mut table: HashMap<int, int> = HashMap::new();
181-
// let mut empty: HashMap<int, int> = HashMap::new();
178+
#[test]
179+
fn test_hashmap() {
180+
let mut table: HashMap<int, int> = HashMap::new();
181+
let empty: HashMap<int, int> = HashMap::new();
182+
183+
table.insert(3, 4);
184+
table.insert(1, 2);
182185
183-
// table.insert(3, 4);
184-
// table.insert(1, 2);
186+
let table_str = table.to_str();
185187
186-
// assert!(table.to_str() == ~"{1 : 2, 3 : 4}");
187-
// assert!(empty.to_str() == ~"{}");
188-
//}
188+
assert!(table_str == ~"{1 : 2, 3 : 4}" || table_str == ~"{3 : 4, 1 : 2}");
189+
assert!(empty.to_str() == ~"{}");
190+
}
189191
}

0 commit comments

Comments
 (0)