Skip to content

Commit

Permalink
Add tests for RT #111866
Browse files Browse the repository at this point in the history
  • Loading branch information
usev6 committed Oct 25, 2014
1 parent 60a2bd5 commit 933059b
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion S04-phasers/keep-undo.t
Expand Up @@ -2,7 +2,10 @@ use v6;

use Test;

plan 12;
use lib 't/spec/packages';
use Test::Util;

plan 16;

# L<S04/Phasers/KEEP "at every successful block exit">
# L<S04/Phasers/UNDO "at every unsuccessful block exit">
Expand Down Expand Up @@ -83,4 +86,35 @@ plan 12;
ok $undone, 'fail() triggers UNDO';
}

# RT #111866
{
#?rakudo.parrot skip "RT #111866"
is_run( q[UNDO { say 'undone' }; die 'foobar'],
{
out => "undone\n",
err => /foobar/,
},
'UNDO fires after die' );

#?rakudo.parrot skip "RT #111866"
#?rakudo.jvm skip "RT #111866"
is_run( q[do { UNDO { say 'undone' }; die 'foobar' }],
{
out => "undone\n",
err => /foobar/,
},
'UNDO fires after die' );

my $undone = 0;
try { UNDO $undone = 1; die 'foobar' };
#?rakudo.jvm todo "RT #111866"
ok $undone, 'UNDO fires after die if block is a "try" block';

my $undone_sub = 0;
sub foo { UNDO $undone_sub = 1; fail };
foo();
ok $undone_sub, 'UNDO in sub fires after "fail"';
}


# vim: ft=perl6

0 comments on commit 933059b

Please sign in to comment.