Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests for Supply.do + some simplifications
  • Loading branch information
lizmat committed Apr 19, 2014
1 parent 9bf4cfb commit 729b330
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions S17-concurrency/supply.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 126;
plan 134;

sub tap_ok ( $s, $expected, $text ) {
ok $s ~~ Supply, "{$s.^name} appears to be doing Supply";
Expand Down Expand Up @@ -66,14 +66,17 @@ for (ThreadPoolScheduler, CurrentThreadScheduler) {
}

{
my $s = Supply.for( (1..5).map( {[$_]} ) );
tap_ok $s, [[1],[2],[3],[4],[5]], "On demand publish with arrays";
my $seen;
tap_ok Supply.for(1..10).do( {$seen++} ),
[1..10], ".do worked";
is $seen, 10, "did the side effect work";
}

{
my $s = Supply.for( [1,2],[3,4,5] ).map( {.flat} );
tap_ok $s, [1..5], "On demand publish with flattened arrays";
}
tap_ok Supply.for( (1..5).map( {[$_]} ) ),
[[1],[2],[3],[4],[5]], "On demand publish with arrays";

tap_ok Supply.for( [1,2],[3,4,5] ).map( {.flat} ),
[1..5], "On demand publish with flattened arrays";

#?rakudo.jvm skip "hangs"
{
Expand Down

0 comments on commit 729b330

Please sign in to comment.