Skip to content

Commit

Permalink
Test that .classify evaluates &test only once for each item
Browse files Browse the repository at this point in the history
RT #126032
  • Loading branch information
niner committed Sep 14, 2015
1 parent 6043ba0 commit 621b348
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion S32-list/classify.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S32::Containers/"List"/"=item classify">

plan 39;
plan 40;

{
my @list = 1, 2, 3, 4;
Expand Down Expand Up @@ -109,6 +109,14 @@ plan 39;

is classify( { "foo" }, () ).elems, 0, 'classify an empty list';

# RT #126032
{
is-deeply
<a b c>.classify({ ~($ ~= $_); }),
{'a' => ['a'], 'ab' => ['b'], 'abc' => ['c']},
'&test only run once for each item';
}

#?rakudo todo "Not sure how this should be fixed"
lives-ok { my %b := BagHash.new(); %b.classify-list( {.comb}, 20..40 ); }, "Baggy classify-list shouldn't die on this case";

Expand Down

0 comments on commit 621b348

Please sign in to comment.