Skip to content

Commit afb17b9

Browse files
committed
Fix tests after discussion with TimToady++.
1 parent c46f211 commit afb17b9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

S02-types/keybag.t

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,21 @@ sub showkv($x) {
120120
}
121121

122122
{
123-
my $b = KeyBag.new(set <foo bar foo bar baz foo>);
123+
my $b = KeyBag.new({ foo => 10, bar => 1, baz => 2});
124124

125+
# .list is just the keys, as per TimToady:
126+
# http://irclog.perlgeek.de/perl6/2012-02-07#i_5112706
125127
isa_ok $b.list.elems, 3, ".list returns 3 things";
126-
is $b.list.grep(Pair).elems, 3, "... all of which are Pairs";
127-
is $b.list.grep({ .key ~~ Str }).elems, 3, "... the keys of which are Strs";
128+
is $b.list.grep(Str).elems, 3, "... all of which are Str";
128129

129130
isa_ok $b.pairs.elems, 3, ".pairs returns 3 things";
130131
is $b.pairs.grep(Pair).elems, 3, "... all of which are Pairs";
131132
is $b.pairs.grep({ .key ~~ Str }).elems, 3, "... the keys of which are Strs";
133+
is $b.pairs.grep({ .value ~~ Int }).elems, 3, "... and the values of which are Ints";
132134

133-
is $b.grep(Pair).elems, 3, ".iterator yields three Pairs";
134-
is $b.grep({ .key ~~ Str }).elems, 3, "... the keys of which are Strs";
135-
is $b.grep({True}).elems, 3, "... and nothing else";
135+
is $b.iterator.grep(Pair).elems, 3, ".iterator yields three Pairs";
136+
is $b.iterator.grep({ .key ~~ Str }).elems, 3, "... the keys of which are Strs";
137+
is $b.iterator.grep({True}).elems, 3, "... and nothing else";
136138
}
137139

138140
{

0 commit comments

Comments
 (0)