Permalink
Browse files

tests that work on 5.13.1+

  • Loading branch information...
1 parent c0b7157 commit 4776a2b722078bef17a7afa960d59fc483c94fe1 @rjbs committed Oct 29, 2010
Showing with 19 additions and 5 deletions.
  1. +1 −0 Changes
  2. +18 −5 t/basic.t
View
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}
{{$NEXT}}
+ more tests for false exceptions, especially on 5.13
0.002 2010-10-28 00:11:09 America/New_York
add tests for handling of false exceptions
View
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More tests => 5 + ($] >= 5.013001 ? 0 : 1);
use Test::Fatal qw(exception success);
use Try::Tiny 0.07;
@@ -38,11 +38,24 @@ try {
sub DESTROY { eval { my $x = 'o no'; } }
}
+if ($] <= 5.013001) {
+ like(
+ exception { exception {
+ my $blackguard = bless {}, 'BreakException';
+ die "real exception";
+ } },
+ qr{false exception},
+ "we throw a new exception if the exception is false",
+ );
+}
+
+{
+ package FalseObject;
+ use overload 'bool' => sub { return };
+}
+
like(
- exception { exception {
- my $blackguard = bless {}, 'BreakException';
- die "real exception";
- } },
+ exception { exception { die(bless {} => 'FalseObject'); } },
qr{false exception},
"we throw a new exception if the exception is false",
);

0 comments on commit 4776a2b

Please sign in to comment.