Skip to content

Commit f6fe8d9

Browse files
Max Maischeinoalders
authored andcommitted
Use Test::Needs instead of loading optional modules ourselves
Addresses #181 (comment)
1 parent 7fc855e commit f6fe8d9

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

t/message-decode-brotlibomb.t

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@ use Test::More;
88
use HTTP::Headers qw();
99
use HTTP::Response qw();
1010

11-
my $ok = eval {
12-
require IO::Compress::Brotli;
13-
require IO::Uncompress::Brotli;
14-
1;
15-
};
16-
if(! $ok) {
17-
plan skip_all => "IO::Compress::Brotli needed; $@";
18-
exit
19-
}
11+
use Test::Needs 'IO::Compress::Brotli', 'IO::Uncompress::Brotli';
12+
2013
plan tests => 9;
2114

2215
# Create a nasty brotli stream:

t/message-decode-zipbomb.t

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ use Test::More;
88
use HTTP::Headers qw( );
99
use HTTP::Response qw( );
1010

11-
my $ok = eval {
12-
require Compress::Raw::Zlib;
13-
Compress::Raw::Zlib->VERSION('2.061');
14-
1;
15-
};
16-
if(! $ok) {
17-
plan skip_all => "Compress::Raw::Zlib 2.061+ needed; $@";
18-
exit
19-
}
11+
use Test::Needs { 'Compress::Raw::Zlib' => '2.061' };
2012
plan tests => 9;
2113

2214
# Create a nasty gzip stream:

0 commit comments

Comments
 (0)