Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add sanity tests of Supply.merge/zip/zip-latest
  • Loading branch information
lizmat committed Dec 21, 2014
1 parent 98aa348 commit 63fcaaa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 5 additions & 2 deletions S17-supply/merge.t
Expand Up @@ -4,7 +4,7 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 8;
plan 10;

for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";
Expand Down Expand Up @@ -35,6 +35,9 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $s = Supply.for(1..10);
my $m = Supply.merge($s);
ok $s === $m, "merging one supply is a noop";
tap_ok $m, [1..10], "noop rotor";
tap_ok $m, [1..10], "noop merge";
}

throws_like( { Supply.merge(42) },
X::Supply::Combinator, combinator => 'merge' );
}
6 changes: 5 additions & 1 deletion S17-supply/zip-latest.t
Expand Up @@ -4,7 +4,7 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 10;
plan 12;

for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";
Expand Down Expand Up @@ -87,4 +87,8 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
ok $s === $z, 'zipping one supply is a noop with "zip-latest"';
tap_ok $z, [1..10], "noop zip-latest";
}


throws_like( { Supply.zip-latest(42) },
X::Supply::Combinator, combinator => 'zip-latest' );
}
8 changes: 6 additions & 2 deletions S17-supply/zip.t
Expand Up @@ -4,7 +4,7 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 8;
plan 10;

for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";
Expand Down Expand Up @@ -39,6 +39,10 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $s = Supply.for(1..10);
my $z = Supply.zip($s);
ok $s === $z, "zipping one supply is a noop";
tap_ok $z, [1..10], "noop rotor";
tap_ok $z, [1..10], "noop zip";
}

throws_like( { Supply.zip(42) },
X::Supply::Combinator, combinator => 'zip' );

}

0 comments on commit 63fcaaa

Please sign in to comment.