Skip to content

Commit

Permalink
doc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jun 2, 2011
1 parent 225585a commit cbbcc88
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/Test/Fatal.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package Test::Fatal;
is(
exception { might_die; },
undef
undef,
"the code lived",
);
Expand Down Expand Up @@ -70,6 +70,17 @@ between the code calling C<exception> and the thing throwing the exception.
This is considered a I<feature> because it avoids the occasionally twitchy
C<Sub::Uplevel> mechanism.
B<Achtung!> This is not a great idea:
like( exception { ... }, qr/foo/, "foo appears in the exception" );
If the code in the C<...> is going to throw a stack trace with the arguments to
each subroutine in its call stack, the test name, "foo appears in the
exception" will itself be matched by the regex. Instead, write this:
my $exception = exception { ... };
like( $exception, qr/foo/, "foo appears in the exception" );
=cut

sub exception (&;@) {
Expand Down

0 comments on commit cbbcc88

Please sign in to comment.