Skip to content

Commit

Permalink
[Test::Ix] eagerified a gather without take
Browse files Browse the repository at this point in the history
Using a dummy array as a target, we can cause the gather block to run. Since
the gather block has no 'take' in it, the dummy array will be empty.
  • Loading branch information
Carl Masak committed Jul 27, 2013
1 parent dded146 commit 6bd97ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Test/Ix.pm
Expand Up @@ -76,12 +76,12 @@ sub first-index(Code $cond, @array) {
return ();
}

sub count-tests(@tests) {
our sub count-tests(@tests) {
return +traverse-tests(@tests, { take $_ });
}

sub run-tests(@tests) {
my &run-test = {
our sub run-tests(@tests) {
my &runtest = {
my $subname = $_.subst(' ', '-', :global);
my $sub = eval( '&' ~ $subname );
if $sub ~~ Nil {
Expand All @@ -95,5 +95,6 @@ sub run-tests(@tests) {
eval('&after') ~~ Sub
and after();
};
traverse-tests(@tests, &run-test);
# RAKUDO: When we have sink context, we don't need @sink here.
my @sink = traverse-tests(@tests, &runtest);
}

0 comments on commit 6bd97ca

Please sign in to comment.