Permalink
Browse files

doc tweaks

  • Loading branch information...
1 parent 225585a commit cbbcc882ee5c2b35eee60f428287abdf06e058e4 @rjbs committed Jun 2, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/Test/Fatal.pm
View
@@ -12,7 +12,7 @@ package Test::Fatal;
is(
exception { might_die; },
- undef
+ undef,
"the code lived",
);
@@ -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 (&;@) {

0 comments on commit cbbcc88

Please sign in to comment.