Since the first thing I actually tried to do with Pugs was to use the %hash.kv method (see S04.pod) to iterate over the keys and values in a hash, and it of course didn't work since it hasn't been implemented yet, I figured I should at least send in a test for it.

Here's a diff to t/op/hash.t adding a simple test.

-garrett
Index: t/op/hash.t
===================================================================
--- t/op/hash.t (revision 565)
+++ t/op/hash.t (working copy)
@@ -9,7 +9,7 @@
 
 =cut
 
-plan 40;
+plan 42;
 
 # basic lvalue assignment
 
@@ -110,3 +110,11 @@
 todo_is %hash8{'key'}, 'value', 'colonpair :key<value>';
 todo_is %hash8{'three'}, 3, 'colonpair :three(3)';
 
+# kv method
+
+my $key;
+my $val;
+eval 'my %hash9 = (1, 2); for %hash9.kv -> $k,$v { $key = $k; $val = $v; }';
+todo_is($key, 1, "\%hash.kv gave us our key");
+todo_is($val, 2, "\%hash.kv gave us our val");
+

Reply via email to