From 9ed9e8c8d0ff0502697e715c2cd0cedd3323d423 Mon Sep 17 00:00:00 2001 From: Samuel Chase Date: Sat, 11 May 2013 19:25:14 +0530 Subject: [PATCH] Add test: test_hashset() --- src/libcore/to_str.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 299ba45986e6..be0aa5138c7b 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -209,4 +209,18 @@ mod tests { assert!(table_str == ~"{1: 2, 3: 4}" || table_str == ~"{3: 4, 1: 2}"); assert!(empty.to_str() == ~"{}"); } + + #[test] + fn test_hashset() { + let mut set: HashSet = HashSet::new(); + let empty_set: HashSet = HashSet::new(); + + set.insert(1); + set.insert(2); + + let set_str = set.to_str(); + + assert!(set_str == ~"{1, 2}" || set_str == ~"{2, 1}"); + assert!(empty.to_str() == ~"{}"); + } } \ No newline at end of file