Skip to content

Commit

Permalink
Test for RT #118785 (use fatal semantics).
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed May 1, 2015
1 parent fa3bfee commit bf3811c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion S04-exceptions/fail.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 25;
plan 26;

# L<S04/Exceptions/The fail function>

Expand Down Expand Up @@ -85,6 +85,24 @@ plan 25;
lives_ok { use fatal; my $x = defined it-will-fail(); 1 }, 'use fatal respects defined';
}

# RT #118785
{
sub fatal-scope(&todo) {
use fatal;
todo;
}

sub thing-that-fails() {
fail 'oh noes';
}

sub non-fatal-scope {
thing-that-fails() or 42
}

is fatal-scope(&non-fatal-scope), 42, "Fatal scopes are lexical rather than dynamic";
}

done;

# vim: ft=perl6

0 comments on commit bf3811c

Please sign in to comment.