Skip to content

Commit

Permalink
test for #125769, if at end of block throws bind
Browse files Browse the repository at this point in the history
(plus additional failure modes caught while fixing this one)
  • Loading branch information
TimToady committed Dec 19, 2015
1 parent 734565c commit 8b97aa4
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion S32-exceptions/misc.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Test;
use lib "t/spec/packages";
use Test::Util;

plan 384;
plan 387;

throws-like '42 +', Exception, "missing rhs of infix", message => rx/term/;

Expand Down Expand Up @@ -801,4 +801,27 @@ throws-like 'my Int $a is default(Nil)',
is_run q[my @x = gather 43], { status => 0, err => / ^ "WARNINGS" \N* \n "Useless use" .* '43' / }, "sink warns inside of gather";
}

# RT #125769
{
sub a {
if 1 { my $f = Failure.new("foo"); }
unless 0 { my $f = Failure.new("foo"); }
return 1;
}
is a(), 1, "failure assignment at end of if block doesn't blow up";
sub b {
if 1 { my $f := Failure.new("bar"); }
unless 0 { my $f := Failure.new("bar"); }
return 2;
}
is b(), 2, "failure binding at end of if block doesn't blow up";
sub c {
{ my $f := Failure.new("bar"); }
{ my $f := Failure.new("bar") if 1; }
{ my $f := Failure.new("bar") unless 0; }
return 3;
}
is c(), 3, "failure binding at end of block doesn't blow up with or without modifier if";
}

# vim: ft=perl6

0 comments on commit 8b97aa4

Please sign in to comment.