Skip to content

Commit

Permalink
Really, it's .unique now
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Oct 31, 2014
1 parent 7bcc20a commit 31e6e32
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions S17-supply/unique.t
Expand Up @@ -7,34 +7,34 @@ use Test::Tap;
plan 17;

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

for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
diag "**** scheduling with {$*SCHEDULER.WHAT.perl}";

tap_ok Supply.for(1..10,1..10).uniq,
tap_ok Supply.for(1..10,1..10).unique,
[1,2,3,4,5,6,7,8,9,10],
"uniq tap works";
"unique tap works";

tap_ok Supply.for(1..10).uniq(:as(* div 2)),
tap_ok Supply.for(1..10).unique(:as(* div 2)),
[1,2,4,6,8,10],
"uniq with as tap works";
"unique with as tap works";

tap_ok Supply.for(<a A B b c C>).uniq( :with( {$^a.lc eq $^b.lc} ) ),
tap_ok Supply.for(<a A B b c C>).unique( :with( {$^a.lc eq $^b.lc} ) ),
[<a B c>],
"uniq with with tap works";
"unique with with tap works";

tap_ok Supply.for(<a AA B bb cc C>).uniq(
tap_ok Supply.for(<a AA B bb cc C>).unique(
:as( *.substr(0,1) ), :with( {$^a.lc eq $^b.lc} )
),
[<a B cc>],
"uniq with as and with tap works";
"unique with as and with tap works";

{
my $s = Supply.new;
tap_ok $s.uniq( :expires(2) ),
tap_ok $s.unique( :expires(2) ),
[1,2,3,1,2],
'uniq with expiry works',
'unique with expiry works',
:after-tap( {
$s.emit(1);
sleep 1;
Expand All @@ -50,9 +50,9 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

{
my $s = Supply.new;
tap_ok $s.uniq( :as( * div 2 ), :expires(2) ),
tap_ok $s.unique( :as( * div 2 ), :expires(2) ),
[1,2,1,2],
'uniq with as and expiry works',
'unique with as and expiry works',
:after-tap( {
$s.emit(1);
sleep 1;
Expand All @@ -68,9 +68,9 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

{
my $s = Supply.new;
tap_ok $s.uniq( :with( {$^a.lc eq $^b.lc} ), :expires(2) ),
tap_ok $s.unique( :with( {$^a.lc eq $^b.lc} ), :expires(2) ),
[<a b c B>],
'uniq with as and expiry works',
'unique with as and expiry works',
:after-tap( {
$s.emit("a");
sleep 1;
Expand All @@ -87,10 +87,10 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {

{
my $s = Supply.new;
tap_ok $s.uniq(
tap_ok $s.unique(
:as( *.substr(0,1) ), :with( {$^a.lc eq $^b.lc} ), :expires(2) ),
[<a bb c B>],
'uniq with as and expiry works',
'unique with as and expiry works',
:after-tap( {
$s.emit("a");
sleep 1;
Expand Down

0 comments on commit 31e6e32

Please sign in to comment.