summaryrefslogtreecommitdiff
path: root/t/17_101092.t
blob: 2b2983b8748f27a3bb56b7ed3f95f6e866f8dba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/use/bin/perl

use strict;

BEGIN {
    $|  = 1;
    $^W = 1;
}

use Test::More tests => 2;
use t::common;

# RT #101092: Creation of non-standard streamed zip file

# Test that reading a zip file that contains a streamed member, then writing
# it without modification will set the local header fields for crc, compressed 
# length & uncompressed length all to zero.

# streamed.zip can be created with the following one-liner:
#
# perl -MIO::Compress::Zip=zip -e 'zip \"abc" => "streamed.zip", Name => "fred", Stream => 1, Method =>8'

my $infile = "t/data/streamed.zip";
my $outfile = OUTPUTZIP;
passthrough($infile, $outfile); 

my $before = readFile($infile);
my $after = readFile($outfile);

my ($status, $reason) = testZip($outfile);
is $status, 0
    or warn("ziptest said: $reason\n");
ok $before eq $after;