summaryrefslogtreecommitdiff
path: root/cpan/autodie/t/lethal.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-26 05:55:28 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-26 05:55:28 +0100
commite853d2264b77e2bdc0758f8ab38e819629763e81 (patch)
treeb3d56f32ce3c9c2cd3f92f7e91f24ef4417176c0 /cpan/autodie/t/lethal.t
parentad73611d3a91f38464b3d95e2d6b43d4a57ef82f (diff)
downloadperl-e853d2264b77e2bdc0758f8ab38e819629763e81.tar.gz
Move autodie from ext/ to cpan/
Diffstat (limited to 'cpan/autodie/t/lethal.t')
-rwxr-xr-xcpan/autodie/t/lethal.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/cpan/autodie/t/lethal.t b/cpan/autodie/t/lethal.t
new file mode 100755
index 0000000000..244d2f82b2
--- /dev/null
+++ b/cpan/autodie/t/lethal.t
@@ -0,0 +1,17 @@
+#!/usr/bin/perl -w
+use strict;
+use FindBin;
+use Test::More tests => 4;
+use lib "$FindBin::Bin/lib";
+use lethal qw(open);
+
+use constant NO_SUCH_FILE => "this_file_had_better_not_exist";
+
+eval {
+ open(my $fh, '<', NO_SUCH_FILE);
+};
+
+ok($@, "lethal throws an exception");
+isa_ok($@, 'autodie::exception','...which is the correct class');
+ok($@->matches('open'), "...which matches open");
+is($@->file,__FILE__, "...which reports the correct file");