Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bring .tap tests up to spec
  • Loading branch information
lizmat committed Nov 23, 2013
1 parent bcdb5a5 commit 635b34a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
7 changes: 3 additions & 4 deletions S17-concurrency/channel.t
Expand Up @@ -33,14 +33,13 @@ plan 14;
is $c.closed.cause.message, "oh noes", "failure reason conveyed";
}

#?rakudo skip 'disappears'
{
my $p = Supply.for(1..5);
is ~$p.Channel.list, "1 2 3 4 5", "Publish.for and .Channel work";
is ~$p.Channel.list, "1 2 3 4 5", "Supply.for and .Channel work";
}

#?rakudo skip 'disappears'
#?rakudo skip 'hangs'
{
my $p = Supply.for(1..5);
is ~@($p.Channel), "1 2 3 4 5", "Publish.for and @(.Channel) work";
is ~@($p.Channel), "1 2 3 4 5", "Supply.for and @(.Channel) work";
}
15 changes: 6 additions & 9 deletions S17-concurrency/supply.t
Expand Up @@ -8,9 +8,8 @@ plan 16;

my @vals;
my $saw_done;
my $tap = $p.tap(
-> $val { @vals.push($val) },
{ $saw_done = True });
my $tap = $p.tap( -> $val { @vals.push($val) },
done => { $saw_done = True });

$p.more(1);
is ~@vals, "1", "Tap got initial value";
Expand Down Expand Up @@ -48,15 +47,13 @@ plan 16;
my $p = Supply.for(1..10, :scheduler(CurrentThreadScheduler));

my @a1;
my $tap1 = $p.tap(
-> $val { @a1.push($val) },
{ @a1.push("end") });
my $tap1 = $p.tap( -> $val { @a1.push($val) },
done => { @a1.push("end") });
is ~@a1, "1 2 3 4 5 6 7 8 9 10 end", "Synchronous publish worked";

my @a2;
my $tap2 = $p.tap(
-> $val { @a2.push($val) },
{ @a2.push("end") });
my $tap2 = $p.tap( -> $val { @a2.push($val) },
done => { @a2.push("end") });
is ~@a2, "1 2 3 4 5 6 7 8 9 10 end", "Second tap also gets all values";
}

Expand Down

0 comments on commit 635b34a

Please sign in to comment.