diff options
author | Paul Marquess <paul.marquess@btinternet.com> | 2006-03-31 10:48:36 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-03-31 12:10:57 +0000 |
commit | 4d91e28241ad974dc4df24b1f21b7278e74f5310 (patch) | |
tree | 5efb9a4690399942519efd88acc88608a0a604c7 /ext/Compress | |
parent | 414ef3ea9175fb97702b64f7bf165596a34444d7 (diff) | |
download | perl-4d91e28241ad974dc4df24b1f21b7278e74f5310.tar.gz |
IO::Compress::Zip
From: "Paul Marquess" <paul.marquess@ntlworld.com>
Message-ID: <005201c6549f$e7374490$2405140a@myopwv.com>
p4raw-id: //depot/perl@27640
Diffstat (limited to 'ext/Compress')
-rw-r--r-- | ext/Compress/IO/Zlib/t/105oneshot-zip-only.t | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/ext/Compress/IO/Zlib/t/105oneshot-zip-only.t b/ext/Compress/IO/Zlib/t/105oneshot-zip-only.t index 91d950eb59..aaf5bfcf79 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 |