Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add simple tests for Supply.stable
Unfortunately, some of them fail, so there is more work to be done
  • Loading branch information
lizmat committed Apr 28, 2014
1 parent 73c090c commit f3f563b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions S17-supply/stable.t
@@ -0,0 +1,38 @@
use v6;
use lib 't/spec/packages';

use Test;
use Test::Tap;

plan 20;

for (ThreadPoolScheduler, CurrentThreadScheduler) {
$*SCHEDULER = .new;
isa_ok $*SCHEDULER, $_, "***** scheduling with {$_.gist}";

{
my $s = Supply.new;
tap_ok $s.stable(2),
[1,4],
".stable worked",
:after-tap( {
$s.more(1);
sleep 1;
$s.more(1);
sleep 1;
$s.more(2);
$s.more(3);
sleep 1;
$s.more(4);
$s.done;
} ),
:live;
}

{
my $for = Supply.for(1..10);
my $stable = $for.stable(0);
ok $for === $stable, "stable by 0 is a noop";
tap_ok $stable, [1..10], "noop stable";
}
}

0 comments on commit f3f563b

Please sign in to comment.