-
Notifications
You must be signed in to change notification settings - Fork 19
/
002Mult.t
35 lines (28 loc) · 1.05 KB
/
002Mult.t
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
35
######################################################################
# Test suite for Archive::Tar::Wrapper
# by Mike Schilli <cpan@perlmeister.com>
######################################################################
use warnings;
use strict;
use Log::Log4perl qw(:easy);
use File::Path;
use File::Temp qw(tempfile tempdir);
my $TARDIR = "data";
$TARDIR = "t/$TARDIR" unless -d $TARDIR;
my $TMPDIR = tempdir( CLEANUP => 1 );
use Test::More tests => 5;
BEGIN { use_ok('Archive::Tar::Wrapper') };
my $arch = Archive::Tar::Wrapper->new(tmpdir => $TMPDIR);
ok($arch->read("$TARDIR/foo.tgz"), "opening compressed tarfile");
ok($arch->read("$TARDIR/bar.tar"), "opening uncompressed");
my $elements = $arch->list_all();
my $got = join " ", sort map { $_->[0] } @$elements;
is($got, "001Basic.t bar/bar.dat bar/foo.dat", "file check");
# Iterators
$arch->list_reset();
my @elements = ();
while(my $entry = $arch->list_next()) {
push @elements, $entry->[0];
}
$got = join " ", sort @elements;
is($got, "001Basic.t bar/bar.dat bar/foo.dat", "file check via iterator");