Skip to content

Commit 9ed9e8c

Browse files
committed
Add test: test_hashset()
1 parent e2c73cc commit 9ed9e8c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/libcore/to_str.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,18 @@ mod tests {
209209
assert!(table_str == ~"{1: 2, 3: 4}" || table_str == ~"{3: 4, 1: 2}");
210210
assert!(empty.to_str() == ~"{}");
211211
}
212+
213+
#[test]
214+
fn test_hashset() {
215+
let mut set: HashSet<int, int> = HashSet::new();
216+
let empty_set: HashSet<int, int> = HashSet::new();
217+
218+
set.insert(1);
219+
set.insert(2);
220+
221+
let set_str = set.to_str();
222+
223+
assert!(set_str == ~"{1, 2}" || set_str == ~"{2, 1}");
224+
assert!(empty.to_str() == ~"{}");
225+
}
212226
}

0 commit comments

Comments
 (0)