Archive-Probe

 view release on metacpan or  search on metacpan

t/directory_test.t  view on Meta::CPAN

            my ($pattern, $file_ref) = @_;

            if (@$file_ref) {
                $map->{mf} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
            }
            else {
                $map->{mf} = '';
            }
    });
    $probe->add_pattern(
        '404\.jsp',
        sub {
            my ($pattern, $file_ref) = @_;

            if (@$file_ref) {
                $map->{404} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
            }
            else {
                $map->{404} = '';
            }
    });
    $probe->add_pattern(
        'readme\.txt',
        sub {
            my ($pattern, $file_ref) = @_;

            if (@$file_ref) {
                $map->{txt} = $probe->_strip_dir($tmpdir, $file_ref->[0]);
            }

t/directory_test.t  view on Meta::CPAN

    # 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');



( run in 2.493 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )