5 my $symlink_exists = eval { symlink("",""); 1 };
9 unshift @INC, '../lib';
12 if ( $symlink_exists ) { print "1..59\n"; }
13 else { print "1..31\n"; }
17 find(sub { print "ok 1\n" if $_ eq 'filefind.t'; }, ".");
18 finddepth(sub { print "ok 2\n" if $_ eq 'filefind.t'; }, ".");
24 unlink 'FA/FA_ord','FA/FSL','FA/FAA/FAA_ord',
25 'FA/FAB/FAB_ord','FA/FAB/FABA/FABA_ord','FB/FB_ord','FB/FBA/FBA_ord';
36 if ($_[0]) { print "ok $case\n"; }
37 else { print "not ok $case\n"; }
42 if ($_[0]) { print "ok $case\n"; }
43 else { print "not ok $case\n $!\n"; exit 0; }
47 CheckDie( open(my $T,'>',$_[0]) );
51 CheckDie( mkdir($_[0],$_[1]) );
55 print "# '$_' => 1\n";
58 $File::Find::prune=1 if $_ eq 'FABA';
64 MkDir( 'FB/FBA',0770 );
65 touch('FB/FBA/FBA_ord');
66 CheckDie( symlink('../FB','FA/FSL') ) if $symlink_exists;
69 MkDir( 'FA/FAA',0770 );
70 touch('FA/FAA/FAA_ord');
71 MkDir( 'FA/FAB',0770 );
72 touch('FA/FAB/FAB_ord');
73 MkDir( 'FA/FAB/FABA',0770 );
74 touch('FA/FAB/FABA/FABA_ord');
76 %Expect = ('.' => 1, 'FSL' => 1, 'FA_ord' => 1, 'FAB' => 1, 'FAB_ord' => 1,
77 'FABA' => 1, 'FAA' => 1, 'FAA_ord' => 1);
78 delete $Expect{'FSL'} unless $symlink_exists;
79 File::Find::find( {wanted => \&wanted, },'FA' );
80 Check( scalar(keys %Expect) == 0 );
82 %Expect=('FA' => 1, 'FA/FSL' => 1, 'FA/FA_ord' => 1, 'FA/FAB' => 1,
83 'FA/FAB/FAB_ord' => 1, 'FA/FAB/FABA' => 1,
84 'FA/FAB/FABA/FABA_ord' => 1, 'FA/FAA' => 1, 'FA/FAA/FAA_ord' => 1);
85 delete $Expect{'FA/FSL'} unless $symlink_exists;
86 File::Find::find( {wanted => \&wanted, no_chdir => 1},'FA' );
88 Check( scalar(keys %Expect) == 0 );
90 if ( $symlink_exists ) {
91 %Expect=('.' => 1, 'FA_ord' => 1, 'FSL' => 1, 'FB_ord' => 1, 'FBA' => 1,
92 'FBA_ord' => 1, 'FAB' => 1, 'FAB_ord' => 1, 'FABA' => 1, 'FAA' => 1,
95 File::Find::find( {wanted => \&wanted, follow_fast => 1},'FA' );
96 Check( scalar(keys %Expect) == 0 );
97 %Expect=('FA' => 1, 'FA/FA_ord' => 1, 'FA/FSL' => 1, 'FA/FSL/FB_ord' => 1,
98 'FA/FSL/FBA' => 1, 'FA/FSL/FBA/FBA_ord' => 1, 'FA/FAB' => 1,
99 'FA/FAB/FAB_ord' => 1, 'FA/FAB/FABA' => 1, 'FA/FAB/FABA/FABA_ord' => 1,
100 'FA/FAA' => 1, 'FA/FAA/FAA_ord' => 1);
101 File::Find::find( {wanted => \&wanted, follow_fast => 1, no_chdir => 1},'FA' );
102 Check( scalar(keys %Expect) == 0 );
105 print "# of cases: $case\n";