Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adjust eager-hyper.t to the fact that gather returns a Seq now
  • Loading branch information
niner committed Aug 20, 2015
1 parent c191630 commit 211dc1d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions S03-metaops/eager-hyper.t
Expand Up @@ -9,24 +9,24 @@ plan 8;
# Laziness test
{
my $counter = 0;
my @test := gather { for 1 .. 5 { $counter++; take $_ } };
is(@test[0], 1, 'iterator works as expected');
my $test := gather { for 1 .. 5 { $counter++; take $_ } };
is($test[0], 1, 'iterator works as expected');
is($counter, 1, 'iterator was lazy and only ran the block once');
}

# "Counting the elements in the array will also force eager completion."
{
my $counter = 0;
my @test := gather { for 1 .. 5 { $counter++; take $_ } };
is(@test.elems, 5, 'iterator has expected length');
my $test := gather { for 1 .. 5 { $counter++; take $_ } };
is($test.elems, 5, 'iterator has expected length');
is($counter, 5, 'iterator was lazy and only ran the block once');
}

# Eager
{
my $counter = 0;
my @test := eager gather { for 1 .. 5 { $counter++; take $_ } };
is(@test[0], 1, 'iterator works as expected');
my $test := eager gather { for 1 .. 5 { $counter++; take $_ } };
is($test[0], 1, 'iterator works as expected');
is($counter, 5, 'iterator was eager and calculated all the values');
}

Expand All @@ -35,8 +35,8 @@ plan 8;
#?rakudo skip 'hyper prefix NYI RT #124517'
{
my $counter = 0;
my @test := hyper gather { for 1 .. 5 { $counter++; take $_; } };
is(sort @test, <1 2 3 4 5>, 'hyper returned all the values in some order');
my $test := hyper gather { for 1 .. 5 { $counter++; take $_; } };
is(sort $test, <1 2 3 4 5>, 'hyper returned all the values in some order');
is($counter, 5, 'iterator was hyper and calculated all the values');
}

Expand Down

0 comments on commit 211dc1d

Please sign in to comment.