Skip to content

Commit

Permalink
All tests, including newly added test_hashmap() pass. The empty Hash …
Browse files Browse the repository at this point in the history
…Table doesn't need to be mutable.
  • Loading branch information
samebchase committed May 11, 2013
1 parent fd5a352 commit 3c1e787
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/libcore/to_str.rs
Expand Up @@ -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() == ~"{}");
}
}

0 comments on commit 3c1e787

Please sign in to comment.