From: Paul Marquess Date: Fri, 31 Mar 2006 09:48:36 +0000 (+0100) Subject: IO::Compress::Zip X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d91e28241ad974dc4df24b1f21b7278e74f5310;p=p5sagit%2Fp5-mst-13.2.git IO::Compress::Zip From: "Paul Marquess" Message-ID: <005201c6549f$e7374490$2405140a@myopwv.com> p4raw-id: //depot/perl@27640 --- diff --git a/ext/Compress/IO/Zlib/t/105oneshot-zip-only.t b/ext/Compress/IO/Zlib/t/105oneshot-zip-only.t index 91d950e..aaf5bfc 100644 --- a/ext/Compress/IO/Zlib/t/105oneshot-zip-only.t +++ b/ext/Compress/IO/Zlib/t/105oneshot-zip-only.t @@ -23,7 +23,7 @@ BEGIN { $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)) ; @@ -141,7 +141,7 @@ for my $stream (0, 1) 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 ; @@ -171,5 +171,48 @@ for my $stream (0, 1) } } +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