Skip to content

Commit

Permalink
Add test for RT #130572
Browse files Browse the repository at this point in the history
  • Loading branch information
usev6 committed Aug 1, 2019
1 parent 73d8675 commit 207171b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion S32-list/seq.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Test;
use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
use Test::Util;

plan 44;
plan 48;

my @result = 1,2,3;

Expand Down Expand Up @@ -244,3 +244,16 @@ group-of 2 => 'ZEN slices do not cache Seqs' => {
is $s.iterator.pull-one, 1, 'did we get 1 as the first value';
dies-ok { $s[0] }, 'did accessing first element die';
}

# RT #130572
{
my $sum1 = 0;
is (lazy for ^4 { $sum1 += $_; $_ }).WHAT, Seq,
'lazy for loop does not execute prematurely (1)';
ok $sum1 == 0, 'lazy for loop does not execute prematurely (2)';

my $sum2 = 0;
is (for ^4 { $sum2 += $_; $_ }).WHAT, List,
'parenthesis do not imply laziness (1)';
ok $sum2 == 6, 'parenthesis do not imply laziness (2)';
}

0 comments on commit 207171b

Please sign in to comment.