about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Chase <samebchase@gmail.com>2013-05-11 19:25:14 +0530
committerSamuel Chase <samebchase@gmail.com>2013-05-11 19:25:14 +0530
commit9ed9e8c8d0ff0502697e715c2cd0cedd3323d423 (patch)
treea11203929a070fbb7cf0eac08c0f4abfd5d2eafa
parente2c73ccaf22ec3908cf77e604233c5833ac5ae7d (diff)
downloadrust-9ed9e8c8d0ff0502697e715c2cd0cedd3323d423.tar.gz
rust-9ed9e8c8d0ff0502697e715c2cd0cedd3323d423.zip
Add test: test_hashset()
-rw-r--r--src/libcore/to_str.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs
index 299ba45986e..be0aa5138c7 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<int, int> = HashSet::new();
+        let empty_set: HashSet<int, int> = 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