Skip to content

Commit

Permalink
We don't need a CurrentThreadScheduler instance
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jun 5, 2014
1 parent 09c9b75 commit fb9fe03
Show file tree
Hide file tree
Showing 32 changed files with 97 additions and 129 deletions.
7 changes: 3 additions & 4 deletions S17-supply/Channel.t
Expand Up @@ -2,13 +2,12 @@ use v6;

use Test;

plan 13;
plan 11;

dies_ok { Supply.Channel }, 'can not be called as a class method';

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

{
my $s = Supply.new;
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/Promise.t
Expand Up @@ -2,13 +2,12 @@ use v6;

use Test;

plan 15;
plan 13;

dies_ok { Supply.Promise }, 'can not be called as a class method';

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

{
my $s = Supply.new;
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/act.t
Expand Up @@ -2,13 +2,12 @@ use v6;

use Test;

plan 7;
plan 5;

dies_ok { Supply.act({...}) }, 'can not be called as a class method';

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

{
my @seen;
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/basic.t
Expand Up @@ -2,11 +2,10 @@ use v6;

use Test;

plan 24;
plan 22;

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

{
my $s = Supply.new;
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/batch.t
Expand Up @@ -4,13 +4,12 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 13;
plan 11;

dies_ok { Supply.batch(1000) }, 'can not be called as a class method';

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

tap_ok Supply.for(1..14).batch(:elems(5)),
[[1..5],[6..10],[11..14]],
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/categorize.t
Expand Up @@ -4,15 +4,14 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 77;
plan 75;

dies_ok { Supply.categorize( {...} ) }, 'can not be called as a class method';
dies_ok { Supply.categorize( {a=>1} ) }, 'can not be called as a class method';
dies_ok { Supply.categorize( [<a>] ) }, 'can not be called as a class method';

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

{
my &mapper = { $_ div 10 };
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/classify.t
Expand Up @@ -4,15 +4,14 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 41;
plan 39;

dies_ok { Supply.classify( {...} ) }, 'can not be called as a class method';
dies_ok { Supply.classify( {a=>1} ) }, 'can not be called as a class method';
dies_ok { Supply.classify( [<a>] ) }, 'can not be called as a class method';

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

my %mapper is default(0) = ( 11=>1, 12=>1, 13=>1 );
my &mapper = { $_ div 10 };
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/delay.t
Expand Up @@ -4,14 +4,13 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 15;
plan 13;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.delay(1) }, 'can not be called as a class method';

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

#?rakudo skip "doesn't work or can't test"
{
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/do.t
Expand Up @@ -4,14 +4,13 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 7;
plan 5;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.do({...}) }, 'can not be called as a class method';

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

{
my $seen;
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/elems.t
Expand Up @@ -4,14 +4,13 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 7;
plan 5;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.elems }, 'can not be called as a class method';

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

tap_ok Supply.for(42..51).elems, [1..10], "just tracing elems works";

Expand Down
7 changes: 3 additions & 4 deletions S17-supply/flat.t
Expand Up @@ -4,14 +4,13 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 5;
plan 3;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.flat }, 'can not be called as a class method';

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

tap_ok Supply.for( [1,2],[3,4,5] ).flat,
[1..5], "On demand publish with flat";
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/for.t
Expand Up @@ -4,14 +4,13 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 15;
plan 13;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.new.for(1..10) }, 'can not be called as an instance method';

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

{
my $s = Supply.for(1..10);
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/grab.t
Expand Up @@ -4,13 +4,12 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 7;
plan 5;

dies_ok { Supply.grab }, 'can not be called as a class method';

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

tap_ok Supply.for(1..10).grab( {.reverse} ), [10...1], "we can reverse";
tap_ok Supply.for(1..10).grab( {[min] $_} ), [1], "we can find the min";
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/grep.t
Expand Up @@ -4,14 +4,13 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 9;
plan 7;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.grep({...}) }, 'can not be called as a class method';

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

tap_ok Supply.for(1..10).grep( * > 5 ),
[6,7,8,9,10],
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/last.t
Expand Up @@ -4,17 +4,16 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 11;
plan 9;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.last }, 'can not be called as a class method';
#?rakudo todo "we don't have Natural numbers yet"
dies_ok { Supply.new.last(0) }, 'cannot have 0 last';
dies_ok { Supply.new.last("foo") }, 'cannot have "foo" last';

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

tap_ok Supply.for(1..10).last, [10], "the last one works";
tap_ok Supply.for(1..10).last(5), [6..10], "the last five works";
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/list.t
Expand Up @@ -2,13 +2,12 @@ use v6;

use Test;

plan 7;
plan 5;

dies_ok { Supply.list }, 'can not be called as a class method';

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

#?rakudo.jvm skip "hangs"
{
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/map.t
Expand Up @@ -4,14 +4,13 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 11;
plan 9;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.map({...}) }, 'can not be called as a class method';

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

tap_ok Supply.for( (1..5).map( {[$_]} ) ),
[[1],[2],[3],[4],[5]], "On demand publish with arrays";
Expand Down
9 changes: 4 additions & 5 deletions S17-supply/max.t
Expand Up @@ -4,15 +4,14 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 12;
plan 10;

#?rakudo.jvm todo 'QAST::ParamTypeCheck needs to be implemented on jvm'
dies_ok { Supply.max }, 'can not be called as a class method';
dies_ok { Supply.new.max(23) }, 'must be code if specified';

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

tap_ok Supply.for(1..10).max, [1..10],
"ascending max works";
Expand All @@ -21,5 +20,5 @@ for (ThreadPoolScheduler, CurrentThreadScheduler) {
tap_ok Supply.for("a".."e","A".."E").max(*.uc), [<a b c d e>],
"ascending alpha works";
tap_ok Supply.for("E"..."A","e".."a").max(*.lc), ["E"],
"decending alpha works";
"descending alpha works";
}
7 changes: 3 additions & 4 deletions S17-supply/merge.t
Expand Up @@ -4,11 +4,10 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 10;
plan 8;

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

{
my $s1 = Supply.new;
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/migrate.t
@@ -1,14 +1,13 @@
use v6;

use Test;
plan 23;
plan 21;

#?rakudo.jvm todo "D: doesn't work in signatures"
dies_ok { Supply.migrate }, 'can not be called as a class method';

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

{
my $master = Supply.new;
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/min.t
Expand Up @@ -4,15 +4,14 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 12;
plan 10;

#?rakudo.jvm todo 'QAST::ParamTypeCheck needs to be implemented on jvm'
dies_ok { Supply.min }, 'can not be called as a class method';
dies_ok { Supply.new.min(23) }, 'must be code if specified';

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

tap_ok Supply.for(1..10).min, [1],
"ascending min works";
Expand Down
7 changes: 3 additions & 4 deletions S17-supply/minmax.t
Expand Up @@ -4,15 +4,14 @@ use lib 't/spec/packages';
use Test;
use Test::Tap;

plan 12;
plan 10;

#?rakudo.jvm todo 'QAST::ParamTypeCheck needs to be implemented on jvm'
dies_ok { Supply.minmax }, 'can not be called as a class method';
dies_ok { Supply.new.minmax(23) }, 'must be code if specified';

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

tap_ok Supply.for(1..5).minmax, [(1..1),(1..2),(1..3),(1..4),(1..5)],
"ascending minmax works";
Expand Down

0 comments on commit fb9fe03

Please sign in to comment.