| 1 |
use Test::More; |
| 2 |
|
| 3 |
use File::Basename; |
| 4 |
|
| 5 |
my $class = 'Business::ISBN::Data'; |
| 6 |
use_ok $class; |
| 7 |
|
| 8 |
my @subs = qw( |
| 9 |
_parse_range_message |
| 10 |
); |
| 11 |
|
| 12 |
can_ok $class, @subs; |
| 13 |
|
| 14 |
subtest 'file does not exist' => sub { |
| 15 |
my $file = 'lib/Business/ISBN/RangeMessage.yamml'; |
| 16 |
ok ! -e $file, "$file does not exist"; |
| 17 |
|
| 18 |
my $warning; |
| 19 |
local $SIG{'__WARN__'} = sub { $warning .= $_[0] }; |
| 20 |
my $result = Business::ISBN::Data::_parse_range_message( $file ); |
| 21 |
like $warning, qr/Could not open/, 'warning message notes the file is not there'; |
| 22 |
ok ! defined $result, "_parse_range_message returns undef if file does not exist"; |
| 23 |
}; |
| 24 |
|
| 25 |
done_testing(); |