Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update S03-feeds/basic.t with regards to parallelism and lazy lists #538

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 6 additions & 9 deletions S03-feeds/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ use Test;

=begin pod

Tests for the feed operators
Tests for the feed operators

==> and <==

==> and <==

=end pod

plan 23;

{
my @a = (1, 2);
my (@b, @c);

@a ==> @b;
@c <== @a;

Expand Down Expand Up @@ -66,7 +66,6 @@ plan 23;

@data = <1 2 4 5 7 8>;
@data <== grep {$_ % 2} <== eager @data;
#?rakudo 2 todo 'feeds + eager'
is(~@data, ~@odds, '@arr <== grep <== eager @arr works');

@data = <1 2 4 5 7 8>;
Expand All @@ -81,7 +80,6 @@ plan 23;

@data <== map {$_ + 1} <== @tap <== grep {$_ % 2} <== eager @data;
is(@tap, <1 3 5 7 9>, '@tap contained what was expected at the time');
#?rakudo todo 'feeds + eager'
is(@data, <2 4 6 8 10>, 'final result was unaffected by the tap variable');
}

Expand Down Expand Up @@ -114,14 +112,13 @@ plan 23;

# feed and Inf
{
dies-ok { my @a <== 0..Inf }
lives-ok { my @a <== (0..*) }, 'feed from lazy list';
}

{
my $call-count = 0;
my @a <== gather for 1..10 -> $i { $call-count++; take $i };
my @a <== lazy gather for 1..10 -> $i { $call-count++; take $i };
@a[0];
#?rakudo todo "isn't lazy"
is $call-count, 1;
}

Expand Down