Skip to content

Commit

Permalink
Test non-existent files
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Jul 16, 2020
1 parent 583d420 commit 8dafe3e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions t/04-files.t
Expand Up @@ -11,4 +11,14 @@ my $ogg = Ogg::Vorbis::Header::PurePerl->new($ogg_fh);
ok($ogg, 'Create object from a filehandle');
isa_ok($ogg, 'Ogg::Vorbis::Header::PurePerl');

my $warn;
$SIG{__WARN__} = sub {
$warn = "@_";
};

ok(! defined Ogg::Vorbis::Header::PurePerl->new('not-there.ogg'),
'Fail on a non-existent file');

like($warn, qr/does not exist/, 'Correct warning');

done_testing();

0 comments on commit 8dafe3e

Please sign in to comment.