$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 95 + $extra ;
+ plan tests => 119 + $extra ;
use_ok('IO::Compress::Zip', qw(zip $ZipError)) ;
use_ok('IO::Uncompress::Unzip', qw(unzip $UnzipError)) ;
my $lex = new LexFile my $file1;
my $content = "hello ";
- writeFile($file1, $content);
+ #writeFile($file1, $content);
ok zip(\$content => $file1 , Store => !$store, Stream => $stream), " zip ok"
or diag $ZipError ;
}
}
+for my $stream (0, 1)
+{
+ for my $store (0, 1)
+ {
+ title "Stream $stream, Store $store";
+
+ my $file1;
+ my $file2;
+ my $zipfile;
+ my $lex = new LexFile $file1, $file2, $zipfile;
+
+ my $content1 = "hello ";
+ writeFile($file1, $content1);
+
+ my $content2 = "goodbye ";
+ writeFile($file2, $content2);
+
+ my %content = ( $file1 => $content1,
+ $file2 => $content2,
+ );
+
+ ok zip([$file1, $file2] => $zipfile , Store => !$store, Stream => $stream), " zip ok"
+ or diag $ZipError ;
+
+ for my $file ($file1, $file2)
+ {
+ my $got ;
+ if ($stream && ! $store) {
+ #eval ' unzip($zipfile => \$got) ';
+ ok ! unzip($zipfile => \$got, Name => $file), " unzip fails";
+ like $UnzipError, "/Streamed Stored content not supported/",
+ " Streamed Stored content not supported";
+ next ;
+ }
+
+ ok unzip($zipfile => \$got, Name => $file), " unzip $file ok"
+ or diag $UnzipError ;
+
+ is $got, $content{$file}, " content ok";
+ }
+ }
+}
+
# TODO add more error cases