Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests for Supply.delay
We seem to have a problem with the ThreadPool scheduler case :-(
  • Loading branch information
lizmat committed Apr 28, 2014
1 parent 5967271 commit 2db6b29
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions S17-supply/delay.t
@@ -0,0 +1,28 @@
use v6;
use lib 't/spec/packages';

use Test;
use Test::Tap;

plan 22;

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

{
my $delay = 2;
my $now = now;
my $seen;
tap_ok $now.Supply.delay($delay).do( { $seen = now } ),
[$now], ".delay worked";
ok $seen && $seen >= $now + $delay, "supply sufficiently delayed";
}

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

0 comments on commit 2db6b29

Please sign in to comment.