Permalink
Browse files

tests for false exception

  • Loading branch information...
1 parent 686e409 commit fa790949917c7dd13d12c7267500b39d1c706483 @rjbs committed Oct 24, 2010
Showing with 18 additions and 4 deletions.
  1. +1 −0 Changes
  2. +17 −4 t/basic.t
View
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}
{{$NEXT}}
+ add tests for handling of false exceptions
0.001 2010-10-24 00:23:24 America/New_York
first release
View
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 5;
use Test::Fatal qw(exception success);
use Try::Tiny 0.07;
@@ -15,9 +15,6 @@ ok(
"no fatality means no exception",
);
-# TODO: test for fatality of undef exception
-# TODO: test for fatality of false exception
-
try {
die "die";
} catch {
@@ -33,3 +30,19 @@ try {
} success {
pass("a success block runs, passing");
};
+
+# TODO: test for fatality of undef exception?
+
+{
+ package BreakException;
+ sub DESTROY { eval { my $x = 'o no'; } }
+}
+
+like(
+ exception { exception {
+ my $blackguard = bless {}, 'BreakException';
+ die "real exception";
+ } },
+ qr{false exception},
+ "we throw a new exception if the exception is false",
+);

0 comments on commit fa79094

Please sign in to comment.