This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update the Change log in Module::CoreList to include recent commits
[perl5.git] / cpan / autodie / t / lethal.t
CommitLineData
0b09a93a
PF
1#!/usr/bin/perl -w
2use strict;
3use FindBin;
4use Test::More tests => 4;
5use lib "$FindBin::Bin/lib";
6use lethal qw(open);
7
8use constant NO_SUCH_FILE => "this_file_had_better_not_exist";
9
10eval {
11 open(my $fh, '<', NO_SUCH_FILE);
12};
13
14ok($@, "lethal throws an exception");
15isa_ok($@, 'autodie::exception','...which is the correct class');
16ok($@->matches('open'), "...which matches open");
17is($@->file,__FILE__, "...which reports the correct file");