Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
winner {} is only about promises
  • Loading branch information
lizmat committed Apr 7, 2014
1 parent 49c0367 commit f6d09ab
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions S17-concurrency/winner.t
@@ -1,37 +1,7 @@
use v6;
use Test;

plan 9;

#?rakudo.parrot skip 'no implementation of promise/winner'
#?rakudo.moar skip ':in NYI'
{
my $p1 = Promise.in(1);
my $p2 = Promise.in(2);
my @seen;
is( winner * {
done $p1 { @seen.push: 'a'; 'first' }
done $p2 { @seen.push: 'b'; 'second' }
}, 'first', 'did we get the first promise' );
is(winner * {
done $p2 { @seen.push: 'b'; 'second' }
}, 'second', 'did we get the second promise' );
is ~@seen, 'a b', 'did p1,p2 fire in right order';
}

#?rakudo.parrot skip 'no implementation of promise/winner'
{
my @p = start( { sleep 1; 'a' } ), start( { sleep 2; 'b' } );
my @seen;
is( winner * {
done @p { @seen.push: $:v; $:k }
}, 0, 'did we get the first promise' );
sleep 1;
is(winner * {
done @p { @seen.push: $:v; $:k }
}, (0|1), 'did we get the first or second promise' );
is ~@seen, ('a b'|'a a'), 'did @p fire in right order';
}
plan 3;

#?rakudo.parrot skip 'no implementation of channel/winner'
{
Expand Down Expand Up @@ -62,7 +32,7 @@ plan 9;
#?rakudo.parrot skip 'no implementation of channel/winner'
{
my @c = Supply.for(11..15).Channel, Supply.for(16..20).Channel;
my %done;
my %done; # cannot use a simple counter :-(
my @a;
loop {
winner * {
Expand Down

0 comments on commit f6d09ab

Please sign in to comment.