4 my %Expect_File = (); # what we expect for $_
5 my %Expect_Name = (); # what we expect for $File::Find::name/fullname
6 my %Expect_Dir = (); # what we expect for $File::Find::dir
7 my $symlink_exists = eval { symlink("",""); 1 };
13 unshift @INC => '../lib';
15 $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; }
18 if ( $symlink_exists ) { print "1..188\n"; }
19 else { print "1..78\n"; }
21 # Uncomment this to see where File::Find is chdir'ing to. Helpful for
22 # debugging its little jaunts around the filesystem.
25 # *CORE::GLOBAL::chdir = sub ($) {
26 # my($file, $line) = (caller)[1,2];
28 # printf "# cwd: %s\n", cwd();
29 # print "# chdir: @_ from $file at $line\n";
30 # my($return) = CORE::chdir($_[0]);
31 # printf "# newcwd: %s\n", cwd();
40 if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'VMS')
42 # This is a hack - at present File::Find does not produce native names on
43 # Win32 or VMS, so force File::Spec to use Unix names.
44 # must be set *before* importing File::Find
45 require File::Spec::Unix;
46 @File::Spec::ISA = 'File::Spec::Unix';
54 find({wanted => sub { print "ok 1\n" if $_ eq '1_compile.t'; } },
57 finddepth({wanted => sub { print "ok 2\n" if $_ eq '1_compile.t'; } },
62 my $FastFileTests_OK = 0;
65 if (-d dir_path('for_find')) {
66 chdir(dir_path('for_find'));
68 if (-d dir_path('fa')) {
69 unlink file_path('fa', 'fa_ord'),
70 file_path('fa', 'fsl'),
71 file_path('fa', 'faa', 'faa_ord'),
72 file_path('fa', 'fab', 'fab_ord'),
73 file_path('fa', 'fab', 'faba', 'faba_ord'),
74 file_path('fb', 'fb_ord'),
75 file_path('fb', 'fba', 'fba_ord');
76 rmdir dir_path('fa', 'faa');
77 rmdir dir_path('fa', 'fab', 'faba');
78 rmdir dir_path('fa', 'fab');
80 rmdir dir_path('fb', 'fba');
83 chdir(File::Spec->updir);
84 if (-d dir_path('for_find')) {
85 rmdir dir_path('for_find') or print "# Can't rmdir for_find: $!\n";
95 if ($_[0]) { print "ok $case\n"; }
96 else { print "not ok $case\n"; }
101 if ($_[0]) { print "ok $case\n"; }
102 else { print "not ok $case\n $!\n"; exit 0; }
106 CheckDie( open(my $T,'>',$_[0]) );
110 CheckDie( mkdir($_[0],$_[1]) );
113 sub wanted_File_Dir {
114 print "# \$File::Find::dir => '$File::Find::dir'\n";
115 print "# \$_ => '$_'\n";
116 s#\.$## if ($^O eq 'VMS' && $_ ne '.');
117 Check( $Expect_File{$_} );
118 if ( $FastFileTests_OK ) {
119 delete $Expect_File{ $_}
120 unless ( $Expect_Dir{$_} && ! -d _ );
122 delete $Expect_File{$_}
123 unless ( $Expect_Dir{$_} && ! -d $_ );
127 sub wanted_File_Dir_prune {
129 $File::Find::prune=1 if $_ eq 'faba';
133 my $n = $File::Find::name;
134 $n =~ s#\.$## if ($^O eq 'VMS' && $n ne '.');
135 print "# \$File::Find::name => '$n'\n";
136 my $i = rindex($n,'/');
137 my $OK = exists($Expect_Name{$n});
138 unless ($^O eq 'MacOS') {
140 $OK= exists($Expect_Name{substr($n,0,$i)}) if $i >= 0;
144 delete $Expect_Name{$n};
148 print "# \$_ => '$_'\n";
149 s#\.$## if ($^O eq 'VMS' && $_ ne '.');
150 my $i = rindex($_,'/');
151 my $OK = exists($Expect_File{ $_});
152 unless ($^O eq 'MacOS') {
154 $OK= exists($Expect_File{ substr($_,0,$i)}) if $i >= 0;
158 delete $Expect_File{ $_};
162 print "# \$File::Find::dir => '$File::Find::dir'\n";
163 print "# \$_ => '$_'\n";
170 print "# --preprocess--\n";
171 print "# \$File::Find::dir => '$File::Find::dir' \n";
172 foreach $file (@files) {
173 $file =~ s/\.(dir)?$// if $^O eq 'VMS';
175 delete $Expect_Dir{ $File::Find::dir }->{$file};
177 print "# --end preprocess--\n";
178 Check(scalar(keys %{$Expect_Dir{ $File::Find::dir }}) == 0);
179 if (scalar(keys %{$Expect_Dir{ $File::Find::dir }}) == 0) {
180 delete $Expect_Dir{ $File::Find::dir }
186 print "# postprocess: \$File::Find::dir => '$File::Find::dir' \n";
187 delete $Expect_Dir{ $File::Find::dir};
191 # Use dir_path() to specify a directory path that's expected for
192 # $File::Find::dir (%Expect_Dir). Also use it in file operations like
195 # dir_path() concatenates directory names to form a *relative*
196 # directory path, independent from the platform it's run on, although
197 # there are limitations. Don't try to create an absolute path,
198 # because that may fail on operating systems that have the concept of
199 # volume names (e.g. Mac OS). As a special case, you can pass it a "."
200 # as first argument, to create a directory path like "./fa/dir" on
201 # operating systems other than Mac OS (actually, Mac OS will ignore
202 # the ".", if it's the first argument). If there's no second argument,
203 # this function will return the empty string on Mac OS and the string
207 my $first_arg = shift @_;
209 if ($first_arg eq '.') {
210 if ($^O eq 'MacOS') {
212 # ignore first argument; return a relative path
213 # with leading ":" and with trailing ":"
214 return File::Spec->catdir(@_);
216 return './' unless @_;
217 my $path = File::Spec->catdir(@_);
223 } else { # $first_arg ne '.'
224 return $first_arg unless @_; # return plain filename
225 return File::Spec->catdir($first_arg, @_); # relative path
230 # Use topdir() to specify a directory path that you want to pass to
231 # find/finddepth. Basically, topdir() does the same as dir_path() (see
232 # above), except that there's no trailing ":" on Mac OS.
235 my $path = dir_path(@_);
236 $path =~ s/:$// if ($^O eq 'MacOS');
241 # Use file_path() to specify a file path that's expected for $_
242 # (%Expect_File). Also suitable for file operations like unlink etc.
244 # file_path() concatenates directory names (if any) and a filename to
245 # form a *relative* file path (the last argument is assumed to be a
246 # file). It's independent from the platform it's run on, although
247 # there are limitations. As a special case, you can pass it a "." as
248 # first argument, to create a file path like "./fa/file" on operating
249 # systems other than Mac OS (actually, Mac OS will ignore the ".", if
250 # it's the first argument). If there's no second argument, this
251 # function will return the empty string on Mac OS and the string "./"
255 my $first_arg = shift @_;
257 if ($first_arg eq '.') {
258 if ($^O eq 'MacOS') {
260 # ignore first argument; return a relative path
261 # with leading ":", but without trailing ":"
262 return File::Spec->catfile(@_);
264 return './' unless @_;
265 my $path = File::Spec->catfile(@_);
271 } else { # $first_arg ne '.'
272 return $first_arg unless @_; # return plain filename
273 return File::Spec->catfile($first_arg, @_); # relative path
278 # Use file_path_name() to specify a file path that's expected for
279 # $File::Find::Name (%Expect_Name). Note: When the no_chdir => 1
280 # option is in effect, $_ is the same as $File::Find::Name. In that
281 # case, also use this function to specify a file path that's expected
284 # Basically, file_path_name() does the same as file_path() (see
285 # above), except that there's always a leading ":" on Mac OS, even for
286 # plain file/directory names.
289 my $path = file_path(@_);
290 $path = ":$path" if (($^O eq 'MacOS') && ($path !~ /:/));
296 MkDir( dir_path('for_find'), 0770 );
297 CheckDie(chdir( dir_path('for_find')));
298 MkDir( dir_path('fa'), 0770 );
299 MkDir( dir_path('fb'), 0770 );
300 touch( file_path('fb', 'fb_ord') );
301 MkDir( dir_path('fb', 'fba'), 0770 );
302 touch( file_path('fb', 'fba', 'fba_ord') );
303 if ($^O eq 'MacOS') {
304 CheckDie( symlink(':fb',':fa:fsl') ) if $symlink_exists;
306 CheckDie( symlink('../fb','fa/fsl') ) if $symlink_exists;
308 touch( file_path('fa', 'fa_ord') );
310 MkDir( dir_path('fa', 'faa'), 0770 );
311 touch( file_path('fa', 'faa', 'faa_ord') );
312 MkDir( dir_path('fa', 'fab'), 0770 );
313 touch( file_path('fa', 'fab', 'fab_ord') );
314 MkDir( dir_path('fa', 'fab', 'faba'), 0770 );
315 touch( file_path('fa', 'fab', 'faba', 'faba_ord') );
318 %Expect_File = (File::Spec->curdir => 1, file_path('fsl') => 1,
319 file_path('fa_ord') => 1, file_path('fab') => 1,
320 file_path('fab_ord') => 1, file_path('faba') => 1,
321 file_path('faa') => 1, file_path('faa_ord') => 1);
323 delete $Expect_File{ file_path('fsl') } unless $symlink_exists;
326 %Expect_Dir = ( dir_path('fa') => 1, dir_path('faa') => 1,
327 dir_path('fab') => 1, dir_path('faba') => 1,
328 dir_path('fb') => 1, dir_path('fba') => 1);
330 delete @Expect_Dir{ dir_path('fb'), dir_path('fba') } unless $symlink_exists;
331 File::Find::find( {wanted => \&wanted_File_Dir_prune}, topdir('fa') );
332 Check( scalar(keys %Expect_File) == 0 );
335 print "# check re-entrancy\n";
337 %Expect_File = (File::Spec->curdir => 1, file_path('fsl') => 1,
338 file_path('fa_ord') => 1, file_path('fab') => 1,
339 file_path('fab_ord') => 1, file_path('faba') => 1,
340 file_path('faa') => 1, file_path('faa_ord') => 1);
342 delete $Expect_File{ file_path('fsl') } unless $symlink_exists;
345 %Expect_Dir = ( dir_path('fa') => 1, dir_path('faa') => 1,
346 dir_path('fab') => 1, dir_path('faba') => 1,
347 dir_path('fb') => 1, dir_path('fba') => 1);
349 delete @Expect_Dir{ dir_path('fb'), dir_path('fba') } unless $symlink_exists;
351 File::Find::find( {wanted => sub { wanted_File_Dir_prune();
352 File::Find::find( {wanted => sub
353 {} }, File::Spec->curdir ); } },
356 Check( scalar(keys %Expect_File) == 0 );
359 # no_chdir is in effect, hence we use file_path_name to specify the expected paths for %Expect_File
361 %Expect_File = (file_path_name('fa') => 1,
362 file_path_name('fa', 'fsl') => 1,
363 file_path_name('fa', 'fa_ord') => 1,
364 file_path_name('fa', 'fab') => 1,
365 file_path_name('fa', 'fab', 'fab_ord') => 1,
366 file_path_name('fa', 'fab', 'faba') => 1,
367 file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1,
368 file_path_name('fa', 'faa') => 1,
369 file_path_name('fa', 'faa', 'faa_ord') => 1,);
371 delete $Expect_File{ file_path_name('fa', 'fsl') } unless $symlink_exists;
374 %Expect_Dir = (dir_path('fa') => 1,
375 dir_path('fa', 'faa') => 1,
376 dir_path('fa', 'fab') => 1,
377 dir_path('fa', 'fab', 'faba') => 1,
379 dir_path('fb', 'fba') => 1);
381 delete @Expect_Dir{ dir_path('fb'), dir_path('fb', 'fba') }
382 unless $symlink_exists;
384 File::Find::find( {wanted => \&wanted_File_Dir, no_chdir => 1},
385 topdir('fa') ); Check( scalar(keys %Expect_File) == 0 );
390 %Expect_Name = (File::Spec->curdir => 1,
391 file_path_name('.', 'fa') => 1,
392 file_path_name('.', 'fa', 'fsl') => 1,
393 file_path_name('.', 'fa', 'fa_ord') => 1,
394 file_path_name('.', 'fa', 'fab') => 1,
395 file_path_name('.', 'fa', 'fab', 'fab_ord') => 1,
396 file_path_name('.', 'fa', 'fab', 'faba') => 1,
397 file_path_name('.', 'fa', 'fab', 'faba', 'faba_ord') => 1,
398 file_path_name('.', 'fa', 'faa') => 1,
399 file_path_name('.', 'fa', 'faa', 'faa_ord') => 1,
400 file_path_name('.', 'fb') => 1,
401 file_path_name('.', 'fb', 'fba') => 1,
402 file_path_name('.', 'fb', 'fba', 'fba_ord') => 1,
403 file_path_name('.', 'fb', 'fb_ord') => 1);
405 delete $Expect_Name{ file_path('.', 'fa', 'fsl') } unless $symlink_exists;
407 File::Find::finddepth( {wanted => \&wanted_Name}, File::Spec->curdir );
408 Check( scalar(keys %Expect_Name) == 0 );
411 # no_chdir is in effect, hence we use file_path_name to specify the
412 # expected paths for %Expect_File
414 %Expect_File = (File::Spec->curdir => 1,
415 file_path_name('.', 'fa') => 1,
416 file_path_name('.', 'fa', 'fsl') => 1,
417 file_path_name('.', 'fa', 'fa_ord') => 1,
418 file_path_name('.', 'fa', 'fab') => 1,
419 file_path_name('.', 'fa', 'fab', 'fab_ord') => 1,
420 file_path_name('.', 'fa', 'fab', 'faba') => 1,
421 file_path_name('.', 'fa', 'fab', 'faba', 'faba_ord') => 1,
422 file_path_name('.', 'fa', 'faa') => 1,
423 file_path_name('.', 'fa', 'faa', 'faa_ord') => 1,
424 file_path_name('.', 'fb') => 1,
425 file_path_name('.', 'fb', 'fba') => 1,
426 file_path_name('.', 'fb', 'fba', 'fba_ord') => 1,
427 file_path_name('.', 'fb', 'fb_ord') => 1);
429 delete $Expect_File{ file_path_name('.', 'fa', 'fsl') } unless $symlink_exists;
433 File::Find::finddepth( {wanted => \&wanted_File, no_chdir => 1},
434 File::Spec->curdir );
436 Check( scalar(keys %Expect_File) == 0 );
439 print "# check preprocess\n";
443 File::Spec->curdir => {fa => 1, fb => 1},
444 dir_path('.', 'fa') => {faa => 1, fab => 1, fa_ord => 1},
445 dir_path('.', 'fa', 'faa') => {faa_ord => 1},
446 dir_path('.', 'fa', 'fab') => {faba => 1, fab_ord => 1},
447 dir_path('.', 'fa', 'fab', 'faba') => {faba_ord => 1},
448 dir_path('.', 'fb') => {fba => 1, fb_ord => 1},
449 dir_path('.', 'fb', 'fba') => {fba_ord => 1}
452 File::Find::find( {wanted => \&noop_wanted,
453 preprocess => \&my_preprocess}, File::Spec->curdir );
455 Check( scalar(keys %Expect_Dir) == 0 );
458 print "# check postprocess\n";
462 File::Spec->curdir => 1,
463 dir_path('.', 'fa') => 1,
464 dir_path('.', 'fa', 'faa') => 1,
465 dir_path('.', 'fa', 'fab') => 1,
466 dir_path('.', 'fa', 'fab', 'faba') => 1,
467 dir_path('.', 'fb') => 1,
468 dir_path('.', 'fb', 'fba') => 1
471 File::Find::find( {wanted => \&noop_wanted,
472 postprocess => \&my_postprocess}, File::Spec->curdir );
474 Check( scalar(keys %Expect_Dir) == 0 );
477 if ( $symlink_exists ) {
478 print "# --- symbolic link tests --- \n";
479 $FastFileTests_OK= 1;
482 # Verify that File::Find::find will call wanted even if the topdir of
483 # is a symlink to a directory, and it shouldn't follow the link
484 # unless follow is set, which it isn't in this case
485 %Expect_File = ( file_path('fsl') => 1 );
488 File::Find::find( {wanted => \&wanted_File_Dir}, topdir('fa', 'fsl') );
489 Check( scalar(keys %Expect_File) == 0 );
492 %Expect_File = (File::Spec->curdir => 1, file_path('fa_ord') => 1,
493 file_path('fsl') => 1, file_path('fb_ord') => 1,
494 file_path('fba') => 1, file_path('fba_ord') => 1,
495 file_path('fab') => 1, file_path('fab_ord') => 1,
496 file_path('faba') => 1, file_path('faa') => 1,
497 file_path('faa_ord') => 1);
501 %Expect_Dir = (File::Spec->curdir => 1, dir_path('fa') => 1,
502 dir_path('faa') => 1, dir_path('fab') => 1,
503 dir_path('faba') => 1, dir_path('fb') => 1,
504 dir_path('fba') => 1);
506 File::Find::find( {wanted => \&wanted_File_Dir_prune,
507 follow_fast => 1}, topdir('fa') );
509 Check( scalar(keys %Expect_File) == 0 );
512 # no_chdir is in effect, hence we use file_path_name to specify
513 # the expected paths for %Expect_File
515 %Expect_File = (file_path_name('fa') => 1,
516 file_path_name('fa', 'fa_ord') => 1,
517 file_path_name('fa', 'fsl') => 1,
518 file_path_name('fa', 'fsl', 'fb_ord') => 1,
519 file_path_name('fa', 'fsl', 'fba') => 1,
520 file_path_name('fa', 'fsl', 'fba', 'fba_ord') => 1,
521 file_path_name('fa', 'fab') => 1,
522 file_path_name('fa', 'fab', 'fab_ord') => 1,
523 file_path_name('fa', 'fab', 'faba') => 1,
524 file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1,
525 file_path_name('fa', 'faa') => 1,
526 file_path_name('fa', 'faa', 'faa_ord') => 1);
530 %Expect_Dir = (dir_path('fa') => 1,
531 dir_path('fa', 'faa') => 1,
532 dir_path('fa', 'fab') => 1,
533 dir_path('fa', 'fab', 'faba') => 1,
535 dir_path('fb', 'fba') => 1);
537 File::Find::find( {wanted => \&wanted_File_Dir, follow_fast => 1,
538 no_chdir => 1}, topdir('fa') );
540 Check( scalar(keys %Expect_File) == 0 );
544 %Expect_Name = (file_path_name('fa') => 1,
545 file_path_name('fa', 'fa_ord') => 1,
546 file_path_name('fa', 'fsl') => 1,
547 file_path_name('fa', 'fsl', 'fb_ord') => 1,
548 file_path_name('fa', 'fsl', 'fba') => 1,
549 file_path_name('fa', 'fsl', 'fba', 'fba_ord') => 1,
550 file_path_name('fa', 'fab') => 1,
551 file_path_name('fa', 'fab', 'fab_ord') => 1,
552 file_path_name('fa', 'fab', 'faba') => 1,
553 file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1,
554 file_path_name('fa', 'faa') => 1,
555 file_path_name('fa', 'faa', 'faa_ord') => 1);
559 File::Find::finddepth( {wanted => \&wanted_Name,
560 follow_fast => 1}, topdir('fa') );
562 Check( scalar(keys %Expect_Name) == 0 );
564 # no_chdir is in effect, hence we use file_path_name to specify
565 # the expected paths for %Expect_File
567 %Expect_File = (file_path_name('fa') => 1,
568 file_path_name('fa', 'fa_ord') => 1,
569 file_path_name('fa', 'fsl') => 1,
570 file_path_name('fa', 'fsl', 'fb_ord') => 1,
571 file_path_name('fa', 'fsl', 'fba') => 1,
572 file_path_name('fa', 'fsl', 'fba', 'fba_ord') => 1,
573 file_path_name('fa', 'fab') => 1,
574 file_path_name('fa', 'fab', 'fab_ord') => 1,
575 file_path_name('fa', 'fab', 'faba') => 1,
576 file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1,
577 file_path_name('fa', 'faa') => 1,
578 file_path_name('fa', 'faa', 'faa_ord') => 1);
583 File::Find::finddepth( {wanted => \&wanted_File, follow_fast => 1,
584 no_chdir => 1}, topdir('fa') );
586 Check( scalar(keys %Expect_File) == 0 );
589 print "# check dangling symbolic links\n";
590 MkDir( dir_path('dangling_dir'), 0770 );
591 CheckDie( symlink( dir_path('dangling_dir'),
592 file_path('dangling_dir_sl') ) );
593 rmdir dir_path('dangling_dir');
594 touch(file_path('dangling_file'));
595 if ($^O eq 'MacOS') {
596 CheckDie( symlink('dangling_file', ':fa:dangling_file_sl') );
598 CheckDie( symlink('../dangling_file','fa/dangling_file_sl') );
600 unlink file_path('dangling_file');
603 # these tests should also emit a warning
606 %Expect_File = (File::Spec->curdir => 1,
607 file_path('fa_ord') => 1,
608 file_path('fsl') => 1,
609 file_path('fb_ord') => 1,
610 file_path('fba') => 1,
611 file_path('fba_ord') => 1,
612 file_path('fab') => 1,
613 file_path('fab_ord') => 1,
614 file_path('faba') => 1,
615 file_path('faba_ord') => 1,
616 file_path('faa') => 1,
617 file_path('faa_ord') => 1);
623 File::Find::find( {wanted => \&wanted_File, follow => 1,
625 sub { $warn_msg = "$_[0] is a dangling symbolic link" }
627 topdir('dangling_dir_sl'), topdir('fa') );
629 Check( scalar(keys %Expect_File) == 0 );
630 Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| );
631 unlink file_path('fa', 'dangling_file_sl'),
632 file_path('dangling_dir_sl');
637 print "# check recursion\n";
638 if ($^O eq 'MacOS') {
639 CheckDie( symlink(':fa:faa',':fa:faa:faa_sl') );
641 CheckDie( symlink('../faa','fa/faa/faa_sl') );
644 eval {File::Find::find( {wanted => \&simple_wanted, follow => 1,
645 no_chdir => 1}, topdir('fa') ); };
646 Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]faa_sl is a recursive symbolic link| );
647 unlink file_path('fa', 'faa', 'faa_sl');
650 print "# check follow_skip (file)\n";
651 if ($^O eq 'MacOS') {
652 CheckDie( symlink(':fa:fa_ord',':fa:fa_ord_sl') ); # symlink to a file
654 CheckDie( symlink('./fa_ord','fa/fa_ord_sl') ); # symlink to a file
658 eval {File::Find::finddepth( {wanted => \&simple_wanted,
660 follow_skip => 0, no_chdir => 1},
663 Check( $@ =~ m|for_find[:/]fa[:/]fa_ord encountered a second time| );
666 # no_chdir is in effect, hence we use file_path_name to specify
667 # the expected paths for %Expect_File
669 %Expect_File = (file_path_name('fa') => 1,
670 file_path_name('fa', 'fa_ord') => 1,
671 file_path_name('fa', 'fsl') => 1,
672 file_path_name('fa', 'fsl', 'fb_ord') => 1,
673 file_path_name('fa', 'fsl', 'fba') => 1,
674 file_path_name('fa', 'fsl', 'fba', 'fba_ord') => 1,
675 file_path_name('fa', 'fab') => 1,
676 file_path_name('fa', 'fab', 'fab_ord') => 1,
677 file_path_name('fa', 'fab', 'faba') => 1,
678 file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1,
679 file_path_name('fa', 'faa') => 1,
680 file_path_name('fa', 'faa', 'faa_ord') => 1);
684 %Expect_Dir = (dir_path('fa') => 1,
685 dir_path('fa', 'faa') => 1,
686 dir_path('fa', 'fab') => 1,
687 dir_path('fa', 'fab', 'faba') => 1,
689 dir_path('fb','fba') => 1);
691 File::Find::finddepth( {wanted => \&wanted_File_Dir, follow => 1,
692 follow_skip => 1, no_chdir => 1},
695 Check( scalar(keys %Expect_File) == 0 );
696 unlink file_path('fa', 'fa_ord_sl');
699 print "# check follow_skip (directory)\n";
700 if ($^O eq 'MacOS') {
701 CheckDie( symlink(':fa:faa',':fa:faa_sl') ); # symlink to a directory
703 CheckDie( symlink('./faa','fa/faa_sl') ); # symlink to a directory
707 eval {File::Find::find( {wanted => \&simple_wanted, follow => 1,
708 follow_skip => 0, no_chdir => 1},
711 Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]? encountered a second time| );
716 eval {File::Find::find( {wanted => \&simple_wanted, follow => 1,
717 follow_skip => 1, no_chdir => 1},
720 Check( $@ =~ m|for_find[:/]fa[:/]faa[:/]? encountered a second time| );
722 # no_chdir is in effect, hence we use file_path_name to specify
723 # the expected paths for %Expect_File
725 %Expect_File = (file_path_name('fa') => 1,
726 file_path_name('fa', 'fa_ord') => 1,
727 file_path_name('fa', 'fsl') => 1,
728 file_path_name('fa', 'fsl', 'fb_ord') => 1,
729 file_path_name('fa', 'fsl', 'fba') => 1,
730 file_path_name('fa', 'fsl', 'fba', 'fba_ord') => 1,
731 file_path_name('fa', 'fab') => 1,
732 file_path_name('fa', 'fab', 'fab_ord') => 1,
733 file_path_name('fa', 'fab', 'faba') => 1,
734 file_path_name('fa', 'fab', 'faba', 'faba_ord') => 1,
735 file_path_name('fa', 'faa') => 1,
736 file_path_name('fa', 'faa', 'faa_ord') => 1);
740 %Expect_Dir = (dir_path('fa') => 1,
741 dir_path('fa', 'faa') => 1,
742 dir_path('fa', 'fab') => 1,
743 dir_path('fa', 'fab', 'faba') => 1,
745 dir_path('fb', 'fba') => 1);
747 File::Find::find( {wanted => \&wanted_File_Dir, follow => 1,
748 follow_skip => 2, no_chdir => 1}, topdir('fa') );
750 Check( scalar(keys %Expect_File) == 0 );
751 unlink file_path('fa', 'faa_sl');