Skip to content

Commit

Permalink
Cover async issue from R#1535
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Apr 7, 2018
1 parent f464b68 commit e70ee88
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion MISC/bug-coverage-stress.t
Expand Up @@ -7,7 +7,7 @@ use Test::Util;
# or ones that need to be only part of strestest and not spectest.
# Feel free to move the tests to more appropriate places.

plan 9;
plan 11;

# RT #132042
doesn't-hang
Expand Down Expand Up @@ -157,4 +157,51 @@ is_run 「use RAKUDO1413; print 'pass'」,
pass 'no crashes with Whatever curries in topics of for/given statement modifiers';
}

{ # https://github.com/rakudo/rakudo/issues/1535
my class R1535Log::Async {
has $.supplier = Supplier.new;
has $.supply = $!supplier.Supply;

my $instance = R1535Log::Async.new;
method instance {
return $instance
}
}

sub foo() {
R1535Log::Async.instance.supplier.emit: AAAAAAA!!!
}

my atomicint $x;
R1535Log::Async.instance.supply.act: { $x+= .chars };
Promise.at(now).then(&foo).then(&foo).then(&foo).then: &foo for ^100;
sleep 1;
#?rakudo todo 'https://github.com/rakudo/rakudo/issues/1535'
is $x, 4000, 'collected right amount of characters (with &foo)';
}

{ # https://github.com/rakudo/rakudo/issues/1535
my class R1535Log::Async {
has $.supplier = Supplier.new;
has $.supply = $!supplier.Supply;

my $instance = R1535Log::Async.new;
method instance {
return $instance
}
}

sub foo() {
R1535Log::Async.instance.supplier.emit: AAAAAAA!!!
}

my atomicint $x;
R1535Log::Async.instance.supply.act: { $x+= .chars };
for ^100 {
Promise.at(now).then({ foo }).then({ foo }).then({ foo }).then({ foo })
}
sleep 1;
is $x, 4000, 'collected right amount of characters (with { foo })';
}

# vim: expandtab shiftwidth=4 ft=perl6

0 comments on commit e70ee88

Please sign in to comment.