Commit | Line | Data |
---|---|---|
0b09a93a | 1 | #!/usr/bin/perl -w |
2 | use strict; | |
3 | use FindBin; | |
4 | use Test::More tests => 4; | |
5 | use lib "$FindBin::Bin/lib"; | |
6 | use lethal qw(open); | |
7 | ||
8 | use constant NO_SUCH_FILE => "this_file_had_better_not_exist"; | |
9 | ||
10 | eval { | |
11 | open(my $fh, '<', NO_SUCH_FILE); | |
12 | }; | |
13 | ||
14 | ok($@, "lethal throws an exception"); | |
15 | isa_ok($@, 'autodie::exception','...which is the correct class'); | |
16 | ok($@->matches('open'), "...which matches open"); | |
17 | is($@->file,__FILE__, "...which reports the correct file"); |