Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"; | ||
| } | ||
| } |