about summary refs log tree commit diff
path: root/src/test/run-pass/class-iface-bounded-param.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/run-pass/class-iface-bounded-param.rs')
-rw-r--r--src/test/run-pass/class-iface-bounded-param.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/run-pass/class-iface-bounded-param.rs b/src/test/run-pass/class-iface-bounded-param.rs
new file mode 100644
index 00000000000..fd0ea20b5fb
--- /dev/null
+++ b/src/test/run-pass/class-iface-bounded-param.rs
@@ -0,0 +1,23 @@
+use std;
+import std::map::{map, hashmap, int_hash};
+
+class keys<K: copy, V: copy, M: copy map<K,V>>
+    implements iter::base_iter<K> {
+
+    let map: M;
+
+    new(map: M) {
+        self.map = map;
+    }
+
+    fn each(blk: fn(K) -> bool) { self.map.each { |k, _v| blk(k)} }
+    fn size_hint() -> option<uint> { some(self.map.size()) }
+    fn eachi(blk: fn(uint, K) -> bool) { iter::eachi(self, blk) }
+}
+
+fn main() {
+    let m = int_hash();
+    m.insert(1, 2);
+    m.insert(3, 4);
+    assert iter::to_vec(keys(m)) == [1, 3];
+}