Add ARM files
[dh-make-perl] / dev / arm / libarchive-zip-perl / libarchive-zip-perl-1.18 / t / 05_tree.t
diff --git a/dev/arm/libarchive-zip-perl/libarchive-zip-perl-1.18/t/05_tree.t b/dev/arm/libarchive-zip-perl/libarchive-zip-perl-1.18/t/05_tree.t
new file mode 100644 (file)
index 0000000..6af7963
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
+use FileHandle;
+use File::Spec;
+
+use Test::More tests =>6;
+BEGIN {
+    unshift @INC, "t/"; 
+    require( File::Spec->catfile('t', 'common.pl') )
+               or die "Can't load t/common.pl";
+}
+
+use constant FILENAME => File::Spec->catfile(TESTDIR, 'testing.txt');
+
+my $zip;
+my @memberNames;
+
+sub makeZip
+{
+       my ($src, $dest, $pred) = @_;
+       $zip = Archive::Zip->new();
+       $zip->addTree($src, $dest, $pred);
+       @memberNames = $zip->memberNames();
+}
+
+sub makeZipAndLookFor
+{
+       my ($src, $dest, $pred, $lookFor) = @_;
+       makeZip($src, $dest, $pred);
+       ok( @memberNames );
+       ok( (grep { $_ eq $lookFor } @memberNames) == 1 )
+               or print STDERR "Can't find $lookFor in (" . join(",", @memberNames) . ")\n";
+}
+
+my ($testFileVolume, $testFileDirs, $testFileName) = File::Spec->splitpath($0);
+
+makeZipAndLookFor('.', '', sub { print "file $_\n"; -f && /\.t$/ }, 't/02_main.t' );
+makeZipAndLookFor('.', 'e/', sub { -f && /\.t$/ }, 'e/t/02_main.t');
+makeZipAndLookFor('./t', '', sub { -f && /\.t$/ }, '02_main.t' );