File: 02_zip.t

package info (click to toggle)
libarchive-any-create-perl 0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: perl: 126; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (3)
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
use strict;
use Archive::Any::Create;
use Archive::Zip;

use Test::More 'no_plan';

my $archive = Archive::Any::Create->new;

$archive->container('foo');
$archive->add_file('t/01_tar.t', "foobar\n");
$archive->add_file('t/02_xxx.t', "bazbaz\n");
$archive->write_file('foo.zip');

open OUT, "> foo2.zip";
$archive->write_filehandle(\*OUT, "zip");
close OUT;

for my $file (qw( foo.zip foo2.zip )) {
    my $zip = Archive::Zip->new;
    $zip->read($file);
    ok $zip->memberNamed('foo/t/01_tar.t');
    is_deeply [ map $_->fileName, $zip->members ], [ 'foo/', 'foo/t/01_tar.t', 'foo/t/02_xxx.t' ];
    unlink $file;
}