Skip to content

Commit

Permalink
streamzip: tighten up version tests for failing windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pmqs committed Apr 24, 2022
1 parent 0ac0d1e commit 3497645
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
20 changes: 12 additions & 8 deletions lib/IO/Compress/Zip.pm
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,24 @@ sub isMethodAvailable
if $method == ZIP_CM_STORE || $method == ZIP_CM_DEFLATE ;

return 1
if $method == ZIP_CM_BZIP2 and
defined $IO::Compress::Adapter::Bzip2::VERSION;
if $method == ZIP_CM_BZIP2 &&
defined $IO::Compress::Adapter::Bzip2::VERSION &&
defined &{ "IO::Compress::Adapter::Bzip2::mkRawZipCompObject" };

return 1
if $method == ZIP_CM_LZMA and
defined $IO::Compress::Adapter::Lzma::VERSION;
if $method == ZIP_CM_LZMA &&
defined $IO::Compress::Adapter::Lzma::VERSION &&
defined &{ "IO::Compress::Adapter::Lzma::mkRawZipCompObject" };

return 1
if $method == ZIP_CM_XZ and
defined $IO::Compress::Adapter::Xz::VERSION;
if $method == ZIP_CM_XZ &&
defined $IO::Compress::Adapter::Xz::VERSION &&
defined &{ "IO::Compress::Adapter::Xz::mkRawZipCompObject" };

return 1
if $method == ZIP_CM_ZSTD and
defined $IO::Compress::Adapter::ZSTD::VERSION;
if $method == ZIP_CM_ZSTD &&
defined $IO::Compress::Adapter::ZSTD::VERSION &&
defined &{ "IO::Compress::Adapter::ZSTD::mkRawZipCompObject" };

return 0;
}
Expand Down
13 changes: 8 additions & 5 deletions t/011-streamzip.t
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ sub check


# streamzip
# ########
# #########

{
title "streamzip" ;
Expand Down Expand Up @@ -123,22 +123,25 @@ for my $method (qw(store deflate bzip2 lzma xz zstd))
{
if ($method eq 'lzma')
{
eval { require IO::Compress::Lzma } ;
no warnings;
eval { require IO::Compress::Lzma && defined &{ 'IO::Compress::Adapter::Bzip2::mkRawZipCompObject' } } ;
skip "Method 'lzma' needs IO::Compress::Lzma\n", 8
if $@;
}

if ($method eq 'zstd')
{
eval { require IO::Compress::Zstd } ;
no warnings;
eval { require IO::Compress::Zstd && defined &{ 'IO::Compress::Adapter::Zstd::mkRawZipCompObject' }} ;
skip "Method 'zstd' needs IO::Compress::Zstd\n", 8
if $@;
}

if ($method eq 'xz')
{
eval { require IO::Compress::Xz } ;
skip "Method 'zstd' needs IO::Compress::Xz\n", 8
no warnings;
eval { require IO::Compress::Xz && defined &{ 'IO::Compress::Adapter::Xz::mkRawZipCompObject' }} ;
skip "Method 'xz' needs IO::Compress::Xz\n", 8
if $@;
}

Expand Down

0 comments on commit 3497645

Please sign in to comment.