view release on metacpan or search on metacpan
t/deep_nest_all_test.t view on Meta::CPAN
$map->{abc} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{abc} = '';
}
});
my $base = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base, 1);
# verify that the .abc file is found
my $exp = catdir(
'a.rar__',
'b.tgz__',
'c.bz2__',
'd.zip__',
'e.7z__',
'version.abc'
);
is(
$map->{abc},
t/deep_nest_all_test.t view on Meta::CPAN
rmtree($tmpdir);
$map = {};
$tmpdir = tempdir('_arXXXXXXXX', DIR => File::Spec->tmpdir());
$probe->working_dir($tmpdir);
$base = catdir($test_data_dir, $test_data_no, "a.rar");
$probe->reset_matches();
$probe->search($base, 1);
# verify that the .abc file is found
is(
$map->{abc},
$exp,
'file search in deep nested archive(start w/ file)'
);
$b = catfile(
$tmpdir,
'a.rar__',
'b.tgz'
t/deep_nest_tar_test.t view on Meta::CPAN
$map->{abc} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{abc} = '';
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify that the .abc file is found
my $exp = catdir(
'a.tar__',
'b.tgz__',
'c.bz2__',
'version.abc'
);
is(
$map->{abc},
$exp,
'file search in deep nested tar archive'
t/directory_test.t view on Meta::CPAN
$map->{target} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{target} = '';
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify that the target.abc file is found
my $exp = catfile('rar_w_dir.rar__', 'leading_dir', 'target.abc');
is(
$map->{target},
$exp,
'file search in rar'
);
my $a = catfile($tmpdir, 'rar_w_dir.rar__', 'leading_dir', 'target.abc');
ok(-f $a, 'existence of target.abc');
# verify that the version.abc file is found
$exp = catdir('rar_wo_dir.rar__', 'version.abc');
is(
$map->{version},
$exp,
'toplevel file search in rar'
);
my $b = catfile($tmpdir, 'rar_wo_dir.rar__', 'version.abc');
ok(-f $b, 'existence of version.abc');
}
t/directory_test.t view on Meta::CPAN
$map->{jsp} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{jsp} = '';
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify that the target.abc file is found
my $exp = catfile('webapp.zip__', 'WEB-INF', 'config.xml');
is(
$map->{xml},
$exp,
'file search in zip'
);
my $a = catfile($tmpdir, 'webapp.zip__', 'WEB-INF', 'config.xml');
ok(-f $a, 'existence of config.xml');
# verify that the index.jsp file is found
$exp = catdir('webapp.zip__', 'index.jsp');
is(
$map->{jsp},
$exp,
'toplevel file search in zip'
);
my $b = catfile($tmpdir, 'webapp.zip__', 'index.jsp');
ok(-f $b, 'existence of index.jsp');
}
t/directory_test.t view on Meta::CPAN
$map->{txt} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{txt} = '';
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify that the manifest.mf file is found
my $exp = catfile('dir1', 'a.tgz__', 'META-INF', 'manifest.mf');
is(
$map->{mf},
$exp,
'file search in tgz under sub-directory'
);
my $a = catfile($tmpdir, 'dir1', 'a.tgz__', 'META-INF', 'manifest.mf');
ok(-f $a, 'existence of manifest.mf');
# verify that the 404.jsp file is found
$exp = catdir('dir1', 'a.tgz__', '404.jsp');
is(
$map->{404},
$exp,
'toplevel file search in tgz under sub-directory'
);
my $b = catfile($tmpdir, 'dir1', 'a.tgz__', '404.jsp');
ok(-f $b, 'existence of 404.jsp');
# verify that the readme.txt file is found
$exp = catfile('dir2', 'readme.txt');
is(
$map->{txt},
$exp,
'unarchived file search in sub-directory'
);
my $c = catfile($tmpdir, 'dir2', 'readme.txt');
ok(-f $c, 'existence of readme.txt');
}
t/extract_flat_test.t view on Meta::CPAN
);
$e_7z = catfile(
$tmpdir,
'e.7z'
);
$dir_txt = catfile(
$tmpdir,
'dir.txt'
);
$ret = $probe->extract($base, $tmpdir, 1, 1);
# verify that the dir.txt exists in top level folder
ok(
$ret &&
-f $dir_txt &&
-f $b_tgz &&
-f $c_bz2 &&
-f $d_zip &&
-f $e_7z &&
-f $ver_abc,
'Flat Recurisve extract top level file in deep nested archive(starts w/ dir)'
);
t/extract_flat_test.t view on Meta::CPAN
);
$e_7z = catfile(
$tmpdir,
'e.7z'
);
$dir_txt = catfile(
$tmpdir,
'dir.txt'
);
$ret = $probe->extract($base, $tmpdir, 1, 1);
# verify that all files are extracted into the top level folder
ok(
$ret &&
-f $dir_txt &&
-f $b_tgz &&
-f $c_bz2 &&
-f $d_zip &&
-f $e_7z &&
-f $ver_abc,
'Flat Recurisve extract top level file in deep nested archive(starts w/ file)'
);
t/extract_nested_test.t view on Meta::CPAN
);
$b_tgz = catfile(
$tmpdir,
'b.tgz'
);
$dir_txt = catfile(
$tmpdir,
'dir.txt'
);
$ret = $probe->extract($base, $tmpdir, 1);
# verify that the dir.txt exists in top level folder
ok(
$ret &&
-f $dir_txt,
'Recurisve extract top level file in deep nested archive(starts w/ dir)'
);
# verify that the version.abc is extracted
ok(
-f $ver_abc,
'Recurisve extract nested file in deep nested archive(starts w/ dir)'
);
# cleanup the temp directory to free disk space
rmtree($tmpdir);
# Non-recursive extract start with file test case
$tmpdir = tempdir('_arXXXXXXXX', DIR => File::Spec->tmpdir());
$b_tgz = catfile(
t/extract_nested_test.t view on Meta::CPAN
);
$b_tgz = catfile(
$tmpdir,
'b.tgz'
);
$dir_txt = catfile(
$tmpdir,
'dir.txt'
);
$ret = $probe->extract($base, $tmpdir, 1);
# verify that the dir.txt exists in top level folder
ok(
$ret &&
-f $dir_txt,
'Recurisve extract top level file in deep nested archive(starts w/ file)'
);
# verify that the version.abc is extracted
$ver_abc = catfile(
$tmpdir,
'b.tgz__',
'c.bz2__',
'd.zip__',
'e.7z__',
'version.abc'
);
ok(
-f $ver_abc,
t/java_archive_test.t view on Meta::CPAN
$map->{clazz} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{clazz} = '';
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify that the MANIFEST.MF file is found
my $exp = catdir(
'oro.jar__',
'META-INF',
'MANIFEST.MF'
);
is(
$map->{mf},
$exp,
'search MANIFEST in jar file'
);
# verify that the MANIFEST.MF file is extracted correctly
my $f = catfile(
$tmpdir,
'oro.jar__',
'META-INF',
'MANIFEST.MF'
);
ok(-f $f, 'existence of MANIFEST.MF');
# verify that the Pattern.class file is found
$exp = catdir(
'oro.jar__',
'org',
'apache',
'oro',
'text',
'regex',
'Pattern.class'
);
is(
$map->{clazz},
$exp,
'search org.apache.oro.text.regex.Pattern in jar file'
);
# verify that the MANIFEST.MF file is extracted correctly
$f = catfile(
$tmpdir,
'oro.jar__',
'org',
'apache',
'oro',
'text',
'regex',
'Pattern.class'
);
t/meta_char_in_filename_test.t view on Meta::CPAN
$map->{go} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{go} = '';
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify that the version.abc file is found
my $exp = catfile(
'a.zip__',
'\\version.abc'
);
is(
$map->{version},
$exp,
'bashslash in file name test'
);
# verify that the "hell.go" file is found
$exp = catfile(
'c.zip__',
"\\Rock & Roll 't.zip__",
'go',
'hello.go'
);
is(
$map->{go},
$exp,
'space, single quote, backslash in file name test'
t/meta_char_in_filename_test.t view on Meta::CPAN
$map->{txt} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
}
else {
$map->{txt} = '';
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify abc's.zip exists
my $a = catfile(
$tmpdir,
'a.rar__',
'abc\'s.zip'
);
ok(-f $a, 'existence of matched file');
# verify that the abc.d file is found
my $exp = catfile(
'a.rar__',
'abc\'s.zip__',
'abc.d'
);
is(
$map->{dot_d},
$exp,
'single quote in zip file name test'
);
$a = catfile(
$tmpdir,
'a.rar__',
'abc\'s.zip__',
'abc.d'
);
ok(-f $a, 'existence of matched file');
# verify that the "quick & dirty sort.hpp" file is found
$exp = catfile(
'b.zip__',
'cpp',
'quick & dirty sort.hpp'
);
is(
$map->{hpp},
$exp,
'space in file name test'
);
$a = catfile(
$tmpdir,
'b.zip__',
'cpp',
'quick & dirty sort.hpp'
);
ok(-f $a, 'existence of matched file');
# verify that the "my ##&**|>>(1).txt" file is found
$exp = catfile(
'd.zip__',
'a{0} (0) [0]',
'my ##&**|>>(1).txt'
);
is(
$map->{txt},
$exp,
'comprehensive meta-char file name test'
);
t/search_archive_itself_test.t view on Meta::CPAN
if (@$file_ref) {
my %m1 = map {$_ => 1} @$file_ref;
$map = \%m1;
}
});
my $base_dir = catdir($test_data_dir, $test_data_no);
$probe->reset_matches();
$probe->search($base_dir, 1);
# verify overall matches
is(keys(%$map), 5, "Overall matches test");
# verify a.rar is extracted
my $a = catfile(
$tmpdir,
'a.rar'
);
ok($map->{$a} && -f $a, 'extract a.rar test');
# verify b.rar is extracted
my $b = catfile(
$tmpdir,
'a.rar__',
'b.rar'
);
ok($map->{$b} && -f $b, 'extract b.rar test');
# verify c.rar is extracted
my $c = catfile(
$tmpdir,
'a.rar__',
'b.rar__',
'c.rar'
);
ok($map->{$c} && -f $c, 'extract c.rar test');
# verify d.rar is extracted
my $d = catfile(
$tmpdir,
'a.rar__',
'b.rar__',
'c.rar__',
'd.rar'
);
ok($map->{$d} && -f $d, 'extract d.rar test');
# verify e.rar is extracted
my $e = catfile(
$tmpdir,
'a.rar__',
'b.rar__',
'c.rar__',
'd.rar__',
'e.rar'
);
ok($map->{$e} && -f $e, 'extract e.rar test');
# cleanup the temp directory to free disk space
rmtree($tmpdir);
# second pass test, test file existence only
$map = {};
$tmpdir = tempdir('_arXXXXXXXX', DIR => File::Spec->tmpdir());
$probe->working_dir($tmpdir);
$probe->reset_matches();
$probe->search($base_dir, 0);
# verify overall matches
is(keys(%$map), 5, "Overall matches test");
# verify a.rar exists
$a = catfile(
$tmpdir,
'a.rar'
);
ok($map->{$a} && !-f $a, 'a.rar existence test');
# verify b.rar exists
$b = catfile(
$tmpdir,
'a.rar__',
'b.rar'
);
ok($map->{$b} && -f $b, 'b.rar existence test');
# verify c.rar exists
$c = catfile(
$tmpdir,
'a.rar__',
'b.rar__',
'c.rar'
);
ok($map->{$c} && -f $c, 'c.rar existence test');
# verify d.rar exists
$d = catfile(
$tmpdir,
'a.rar__',
'b.rar__',
'c.rar__',
'd.rar'
);
ok($map->{$d} && -f $d, 'd.rar existence test');
# verify e.rar exists
$e = catfile(
$tmpdir,
'a.rar__',
'b.rar__',
'c.rar__',
'd.rar__',
'e.rar'
);
ok($map->{$e} && -f $e, 'e.rar existence test');
}