Patch attached for Perl 6 spec tests for RT #70011:
- 1 previously fudged test re-enabled for rakudo in S29-context/die.t - 7 new tests added to S02-magicals/dollar_bang.t -- Mark Montague markm...@umich.edu
Index: S29-context/die.t =================================================================== --- S29-context/die.t (revision 28893) +++ S29-context/die.t (working copy) @@ -12,9 +12,8 @@ =end pod -#?rakudo todo 'exception handling' { - ok( ! try { die "foo"; 1 }, 'die in try cuts off execution'); + ok( !defined( try { die "foo"; 1; } ), 'die in try cuts off execution'); my $error = $!; is($error, 'foo', 'got $! correctly'); } Index: S02-magicals/dollar_bang.t =================================================================== --- S02-magicals/dollar_bang.t (revision 28893) +++ S02-magicals/dollar_bang.t (working copy) @@ -2,7 +2,7 @@ use Test; -plan 10; +plan 17; =begin desc @@ -53,4 +53,32 @@ #?rakudo todo 'stringification of $!' ok ~($!) ~~ /qwerty/, 'die without argument uses $! properly'; +# RT #70011 +{ + undefine $!; + try { die('goodbye'); } + ok defined( $!.perl ), '$! has working Perl 6 object methods after try'; + ok ($!.WHAT ~~ Exception), '$! is Exception object after try'; + # - S04-statements/try.t tests $! being set after try. + # - S29-context/die.t tests $! being set after die. + # - also tested more generically above. + # So no need to test the value of #! again here. + #is $!, 'goodbye', '$! has correct value after try'; + ok ($!), '$! as boolean works (true)'; + + undefine $!; + eval q[ die('farewell'); ]; + ok defined($!.perl), '$! has working Perl 6 object methods after eval'; + ok ($!.WHAT ~~ Exception), '$! is Exception object after eval'; + # Although S29-context/die.t tests $! being set after die, it's not + # from within an eval, so we test the eval/die combination here. + # As that file (and also S04-statements/try.t) do equality comparisons + # rather than pattern matches, we check equality here, too. + is $!, 'farewell', '$! has correct value after eval'; + + undefine $!; + try { 1; } + ok (! $!), '$! as boolean works (false)'; +} + # vim: ft=perl6