about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstd/hashmap.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs
index c275e8a99ff..1c74901b94d 100644
--- a/src/libstd/hashmap.rs
+++ b/src/libstd/hashmap.rs
@@ -952,6 +952,7 @@ mod test_set {
     use super::*;
     use container::{Container, Map, Set};
     use vec;
+    use uint;
 
     #[test]
     fn test_disjoint() {
@@ -1005,6 +1006,19 @@ mod test_set {
     }
 
     #[test]
+    fn test_iterate() {
+        let mut a = HashSet::new();
+        for uint::range(0, 32) |i| {
+            assert!(a.insert(i));
+        }
+        let mut observed = 0;
+        for a.iter().advance |k| {
+            observed |= (1 << *k);
+        }
+        assert_eq!(observed, 0xFFFF_FFFF);
+    }
+
+    #[test]
     fn test_intersection() {
         let mut a = HashSet::new();
         let mut b = HashSet::new();