2 if( $ENV{PERL_CORE} ) {
3 chdir '../lib/Archive/Tar' if -d '../lib/Archive/Tar';
8 BEGIN { chdir 't' if -d 't' }
10 use Test::More 'no_plan';
14 my $Class = 'Archive::Tar';
15 my $FClass = 'Archive::Tar::File';
16 my $File = 'src/long/bar.tar';
21 qr|^directory/really.*name/$|,
22 qr|^directory/.*/myfile$|,
27 ### crazy ref to special case 'all'
28 for my $index ( \0, 0 .. $#Expect ) {
33 ### do a full test vs individual filters
34 if( not ref $index ) {
35 my $regex = $Expect[$index];
36 $opts{'filter'} = $regex;
42 my $next = $Class->iter( $File, 0, \%opts );
44 my $pp_opts = join " => ", %opts;
45 ok( $next, "Iterator created from $File ($pp_opts)" );
46 isa_ok( $next, "CODE", " Iterator" );
49 while( my $f = $next->() ) {
50 ok( $f, " File object retrieved" );
51 isa_ok( $f, $FClass, " Object" );
53 push @names, $f->name;
56 is( scalar(@names), scalar(@expect),
57 " Found correct number of files" );
60 for my $name ( @names ) {
61 ok( 1, " Inspecting '$name' " );
62 like($name, $expect[$i]," Matches $Expect[$i]" );