Skip to content

Commit

Permalink
Kebabcase tap_ok
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Apr 26, 2015
1 parent 2a4bf77 commit 57d2717
Show file tree
Hide file tree
Showing 34 changed files with 117 additions and 117 deletions.
8 changes: 4 additions & 4 deletions S17-supply/batch.t
Expand Up @@ -11,7 +11,7 @@ dies_ok { Supply.batch(1000) }, 'can not be called as a class method';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(1..14).batch(:elems(5)),
tap-ok Supply.from-list(1..14).batch(:elems(5)),
[[1..5],[6..10],[11..14]],
"we can batch by number of elements";

Expand All @@ -21,7 +21,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $b = $s.batch( :$seconds );
sleep $seconds - now % $seconds; # wait until next $sleep second period
my $base = time div $seconds;
tap_ok $b,
tap-ok $b,
[[$base xx 10],[$base+1 xx 10]],
"we can batch by time",
:timeout(3 * $seconds),
Expand All @@ -42,7 +42,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $b = $s.batch( :$elems, :$seconds );
sleep $seconds - now % $seconds; # wait until next $sleep second period
my $base = time div $seconds;
tap_ok $b,
tap-ok $b,
[[$base xx $elems],[$base xx $rest],
[$base+1 xx $elems],[$base+1 xx $rest]],
"we can batch by time and elems",
Expand All @@ -59,6 +59,6 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $f = Supply.from-list(1..10);
my $b = $f.batch(:elems(1)),
ok $f === $b, "batch by 1 is a noop";
tap_ok $b, [1..10], "noop batch";
tap-ok $b, [1..10], "noop batch";
}
}
6 changes: 3 additions & 3 deletions S17-supply/categorize.t
Expand Up @@ -33,8 +33,8 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

$s.emit($_) for 1,2,3,11,12,13;
is_deeply @keys, [0,1], "did we get the right keys ($what)";
tap_ok @supplies[0], [1,2,3], "got the 0 supply ($what)", :live;
tap_ok @supplies[1], [11,12,13], "got the 1 supply ($what)", :live;
tap-ok @supplies[0], [1,2,3], "got the 0 supply ($what)", :live;
tap-ok @supplies[1], [11,12,13], "got the 1 supply ($what)", :live;
}
}

Expand All @@ -58,7 +58,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

$s.emit($_) for 1,2,3,11,12,13;
is_deeply @keys, [0,1], "did we get the right keys ($what)";
tap_ok @supplies[0], [11,12,13], "got the 0 supply ($what)", :live;
tap-ok @supplies[0], [11,12,13], "got the 0 supply ($what)", :live;

my $done = False;
@supplies[1].tap(done => sub { $done = True });
Expand Down
4 changes: 2 additions & 2 deletions S17-supply/classify.t
Expand Up @@ -32,7 +32,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

$s.emit($_) for 1,2,3,11,12,13;
is_deeply @keys, [0,1], "did we get the right keys ($what)";
tap_ok @supplies[0], [1,2,3], "got the 0 supply ($what)", :live;
tap_ok @supplies[1], [11,12,13], "got the 1 supply ($what)", :live;
tap-ok @supplies[0], [1,2,3], "got the 0 supply ($what)", :live;
tap-ok @supplies[1], [11,12,13], "got the 1 supply ($what)", :live;
}
}
6 changes: 3 additions & 3 deletions S17-supply/delayed.t
Expand Up @@ -16,7 +16,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $delay = 2;
my $now = now;
my $seen;
tap_ok $now.Supply.delayed($delay),
tap-ok $now.Supply.delayed($delay),
[$now],
".delay with on-demand Supply worked",
:emit( { $seen = now } ),
Expand All @@ -30,7 +30,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $s = Supply.new;
my $now = now;
my $seen;
tap_ok $s.delayed($delay),
tap-ok $s.delayed($delay),
[$now],
".delay with live Supply worked",
:live,
Expand All @@ -48,6 +48,6 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $for = Supply.from-list(1..10);
my $delay = $for.delayed(0);
ok $for === $delay, "delaying by 0 is a noop";
tap_ok $delay, [1..10], "noop delay";
tap-ok $delay, [1..10], "noop delay";
}
}
2 changes: 1 addition & 1 deletion S17-supply/do.t
Expand Up @@ -13,7 +13,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

{
my $seen;
tap_ok Supply.from-list(1..10).do( {$seen++} ),
tap-ok Supply.from-list(1..10).do( {$seen++} ),
[1..10], ".do worked";
is $seen, 10, "did the side effect work";
}
Expand Down
4 changes: 2 additions & 2 deletions S17-supply/elems.t
Expand Up @@ -11,11 +11,11 @@ dies_ok { Supply.elems }, 'can not be called as a class method';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(42..51).elems, [1..10], "just tracing elems works";
tap-ok Supply.from-list(42..51).elems, [1..10], "just tracing elems works";

{
my $s = Supply.new;
tap_ok $s.elems(1),
tap-ok $s.elems(1),
[1,2,5],
'works in 1 second increments',
# :live,
Expand Down
2 changes: 1 addition & 1 deletion S17-supply/flat.t
Expand Up @@ -11,7 +11,7 @@ dies_ok { Supply.flat }, 'can not be called as a class method';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list( [1,2],[3,4,5] ).flat,
tap-ok Supply.from-list( [1,2],[3,4,5] ).flat,
[1..5], "On demand publish with flat";

my $s = Supply.new;
Expand Down
10 changes: 5 additions & 5 deletions S17-supply/from-list.t
Expand Up @@ -13,18 +13,18 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

{
my $s = Supply.from-list(1..10);
tap_ok $s, [1..10], "On demand publish worked";
tap_ok $s, [1..10], "Second tap gets all the values";
tap-ok $s, [1..10], "On demand publish worked";
tap-ok $s, [1..10], "Second tap gets all the values";

ok $s.Supply === $s, '.Supply on a Supply is a noop';
}

tap_ok (1..10).Supply,
tap-ok (1..10).Supply,
[1..10], "Supply coercer worked on Range";

tap_ok (1,2,3,4,5,6,7,8,9,10).Supply,
tap-ok (1,2,3,4,5,6,7,8,9,10).Supply,
[1..10], "Supply coercer worked on Parcel";

tap_ok "food".Supply,
tap-ok "food".Supply,
[<food>], "Supply coercer worked on scalar";
}
4 changes: 2 additions & 2 deletions S17-supply/grab.t
Expand Up @@ -11,6 +11,6 @@ dies_ok { Supply.grab }, 'can not be called as a class method';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(1..10).grab( {.reverse} ), [10...1], "we can reverse";
tap_ok Supply.from-list(1..10).grab( {[min] $_} ), [1], "we can find the min";
tap-ok Supply.from-list(1..10).grab( {.reverse} ), [10...1], "we can reverse";
tap-ok Supply.from-list(1..10).grab( {[min] $_} ), [1], "we can find the min";
}
6 changes: 3 additions & 3 deletions S17-supply/grep.t
Expand Up @@ -11,15 +11,15 @@ dies_ok { Supply.grep({...}) }, 'can not be called as a class method';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(1..10).grep( * > 5 ),
tap-ok Supply.from-list(1..10).grep( * > 5 ),
[6,7,8,9,10],
"grepping taps with a Callable works";

tap_ok Supply.from-list(1..10,"a".."z").grep(Int),
tap-ok Supply.from-list(1..10,"a".."z").grep(Int),
[1..10],
"grepping taps with a Type works";

tap_ok Supply.from-list("a".."z").grep(/<[a..e]>/),
tap-ok Supply.from-list("a".."z").grep(/<[a..e]>/),
["a".."e"],
"grepping taps with a Regex works";
}
4 changes: 2 additions & 2 deletions S17-supply/interval.t
Expand Up @@ -9,14 +9,14 @@ plan 3;
dies_ok { Supply.new.interval(1) }, 'can not be called as an instance method';

{
tap_ok Supply.interval(1),
tap-ok Supply.interval(1),
[^5],
'interval of 1 second',
:after-tap( { sleep 4.5 } );
}

{
tap_ok Supply.interval(1, 2),
tap-ok Supply.interval(1, 2),
[^3],
'interval of 1 second with delay of 2',
:after-tap( { sleep 4.5 } );
Expand Down
6 changes: 3 additions & 3 deletions S17-supply/last.t
Expand Up @@ -14,7 +14,7 @@ dies_ok { Supply.new.last("foo") }, 'cannot have "foo" last';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(1..10).last, [10], "the last one works";
tap_ok Supply.from-list(1..10).last(5), [6..10], "the last five works";
tap_ok Supply.from-list(1..10).last(15), [1..10], "the last 15 works";
tap-ok Supply.from-list(1..10).last, [10], "the last one works";
tap-ok Supply.from-list(1..10).last(5), [6..10], "the last five works";
tap-ok Supply.from-list(1..10).last(15), [1..10], "the last 15 works";
}
20 changes: 10 additions & 10 deletions S17-supply/lines.t
Expand Up @@ -15,37 +15,37 @@ dies_ok { Supply.lines }, 'can not be called as a class method';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list( @simple.map: * ~ "\n" ).lines,
tap-ok Supply.from-list( @simple.map: * ~ "\n" ).lines,
@simple,
"handle a simple list of lines with LF";
tap_ok Supply.from-list( @original = @simple.map: * ~ "\n" ).lines(:!chomp),
tap-ok Supply.from-list( @original = @simple.map: * ~ "\n" ).lines(:!chomp),
@original,
"handle a simple list of lines with LF without chomping";

tap_ok Supply.from-list( @simple.map: * ~ "\r" ).lines,
tap-ok Supply.from-list( @simple.map: * ~ "\r" ).lines,
@simple,
"handle a simple list of lines with CR";
tap_ok Supply.from-list( @original = @simple.map: * ~ "\r" ).lines(:!chomp),
tap-ok Supply.from-list( @original = @simple.map: * ~ "\r" ).lines(:!chomp),
@original,
"handle a simple list of lines with CR without chomping";

tap_ok Supply.from-list( @simple.map: * ~ "\r\n" ).lines,
tap-ok Supply.from-list( @simple.map: * ~ "\r\n" ).lines,
@simple,
"handle a simple list of lines with CRLF";
tap_ok Supply.from-list( @original = @simple.map: * ~ "\r\n" ).lines(:!chomp),
tap-ok Supply.from-list( @original = @simple.map: * ~ "\r\n" ).lines(:!chomp),
@original,
"handle a simple list of lines with CRLF without chomping";

tap_ok Supply.from-list( @simple.map: * ~ @endings.pick ).lines,
tap-ok Supply.from-list( @simple.map: * ~ @endings.pick ).lines,
@simple,
"handle a simple list of lines with mixed line ending";
tap_ok Supply.from-list(@original= @simple.map: * ~ @endings.pick).lines(:!chomp),
tap-ok Supply.from-list(@original= @simple.map: * ~ @endings.pick).lines(:!chomp),
@original,
"handle a simple list of lines with mixed line ending w/o chomping";

{
my $s = Supply.new;
tap_ok $s.lines,
tap-ok $s.lines,
[<a b c d>, '', 'eeee'],
"handle chunked lines",
:after-tap( {
Expand All @@ -59,7 +59,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

{
my $s = Supply.new;
tap_ok $s.lines(:!chomp),
tap-ok $s.lines(:!chomp),
["a\n","b\r\n","c\r","d\n","\n","eeee"],
"handle chunked lines",
:after-tap( {
Expand Down
8 changes: 4 additions & 4 deletions S17-supply/map.t
Expand Up @@ -11,17 +11,17 @@ dies_ok { Supply.map({...}) }, 'can not be called as a class method';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list( (1..5).map( {[$_]} ) ),
tap-ok Supply.from-list( (1..5).map( {[$_]} ) ),
[[1],[2],[3],[4],[5]], "On demand publish with arrays";

tap_ok Supply.from-list( [1,2],[3,4,5] ).map( {.flat} ),
tap-ok Supply.from-list( [1,2],[3,4,5] ).map( {.flat} ),
[1..5], "On demand publish with flattened arrays";

tap_ok Supply.from-list(1..10).map( * * 5 ),
tap-ok Supply.from-list(1..10).map( * * 5 ),
[5,10,15,20,25,30,35,40,45,50],
"mapping tap with single values works";

tap_ok Supply.from-list(1..10).map( { $_ xx 2 } ),
tap-ok Supply.from-list(1..10).map( { $_ xx 2 } ),
[1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10],
"mapping tap with multiple values works";
}
8 changes: 4 additions & 4 deletions S17-supply/max.t
Expand Up @@ -12,12 +12,12 @@ dies_ok { Supply.new.max(23) }, 'must be code if specified';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(1..10).max, [1..10],
tap-ok Supply.from-list(1..10).max, [1..10],
"ascending max works";
tap_ok Supply.from-list(10...1).max, [10],
tap-ok Supply.from-list(10...1).max, [10],
"descending max works";
tap_ok Supply.from-list("a".."e","A".."E").max(*.uc), [<a b c d e>],
tap-ok Supply.from-list("a".."e","A".."E").max(*.uc), [<a b c d e>],
"ascending alpha works";
tap_ok Supply.from-list("E"..."A","e".."a").max(*.lc), ["E"],
tap-ok Supply.from-list("E"..."A","e".."a").max(*.lc), ["E"],
"descending alpha works";
}
6 changes: 3 additions & 3 deletions S17-supply/merge.t
Expand Up @@ -12,7 +12,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
{
my $s1 = Supply.new;
my $s2 = Supply.new;
tap_ok $s1.merge($s2),
tap-ok $s1.merge($s2),
[1,2,'a',3,'b'],
"merging supplies works",
:after-tap( {
Expand All @@ -26,7 +26,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
} );
}

tap_ok Supply.merge(
tap-ok Supply.merge(
Supply.from-list(1..5), Supply.from-list(6..10), Supply.from-list(11..15)
),
[1..15], "merging 3 supplies works", :sort;
Expand All @@ -35,7 +35,7 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
my $s = Supply.from-list(1..10);
my $m = Supply.merge($s);
ok $s === $m, "merging one supply is a noop";
tap_ok $m, [1..10], "noop merge";
tap-ok $m, [1..10], "noop merge";
}

throws_like( { Supply.merge(42) },
Expand Down
8 changes: 4 additions & 4 deletions S17-supply/min.t
Expand Up @@ -12,12 +12,12 @@ dies_ok { Supply.new.min(23) }, 'must be code if specified';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(1..10).min, [1],
tap-ok Supply.from-list(1..10).min, [1],
"ascending min works";
tap_ok Supply.from-list(10...1).min, [10...1],
tap-ok Supply.from-list(10...1).min, [10...1],
"descending min works";
tap_ok Supply.from-list("a".."e","A".."E").min(*.uc), ["a"],
tap-ok Supply.from-list("a".."e","A".."E").min(*.uc), ["a"],
"ascending alpha works";
tap_ok Supply.from-list("E"..."A","e".."a").min(*.lc), [<E D C B A>],
tap-ok Supply.from-list("E"..."A","e".."a").min(*.lc), [<E D C B A>],
"descending alpha works";
}
8 changes: 4 additions & 4 deletions S17-supply/minmax.t
Expand Up @@ -12,14 +12,14 @@ dies_ok { Supply.new.minmax(23) }, 'must be code if specified';
for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.from-list(1..5).minmax, [(1..1),(1..2),(1..3),(1..4),(1..5)],
tap-ok Supply.from-list(1..5).minmax, [(1..1),(1..2),(1..3),(1..4),(1..5)],
"ascending minmax works";
tap_ok Supply.from-list(5...1).minmax, [(5..5),(4..5),(3..5),(2..5),(1..5)],
tap-ok Supply.from-list(5...1).minmax, [(5..5),(4..5),(3..5),(2..5),(1..5)],
"descending minmax works";
tap_ok Supply.from-list("a".."e","A".."E").minmax(*.uc),
tap-ok Supply.from-list("a".."e","A".."E").minmax(*.uc),
[("a".."a"),("a".."b"),("a".."c"),("a".."d"),("a".."e")],
"ascending alpha works";
tap_ok Supply.from-list("E"..."A","e".."a").minmax(*.lc),
tap-ok Supply.from-list("E"..."A","e".."a").minmax(*.lc),
[("E".."E"),("D".."E"),("C".."E"),("B".."E"),("A".."E")],
"descending alpha works";
}
4 changes: 2 additions & 2 deletions S17-supply/on-demand.t
Expand Up @@ -13,8 +13,8 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

{
my $s = Supply.on-demand( -> \s { s.emit($_) for 1..10; s.done } );
tap_ok $s, [1..10], :!live, "On demand publish worked";
tap_ok $s, [1..10], :!live, "Second tap gets all the values";
tap-ok $s, [1..10], :!live, "On demand publish worked";
tap-ok $s, [1..10], :!live, "Second tap gets all the values";

ok $s.Supply === $s, '.Supply on a Supply is a noop';
}
Expand Down

0 comments on commit 57d2717

Please sign in to comment.