2 # Author: Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
6 # The ../../../../../lib is for finding lib/utf8.pm
7 # when running under all-utf8 settings (pod/find.t)
8 # does not directly require lib/utf8.pm but regular
9 # expressions will need that.
10 @INC = qw(../lib ../../../../../lib);
22 use Pod::Find qw(pod_find pod_where);
29 my $lib_dir = File::Spec->catdir('pod', 'testpods', 'lib');
31 $lib_dir = VMS::Filespec::unixify(File::Spec->catdir('pod', 'testpods', 'lib'));
33 $Qlib_dir =~ s#\/#::#g;
35 print "### searching $lib_dir\n";
36 my %pods = pod_find($lib_dir);
37 my $result = join(',', sort values %pods);
38 my $compare = join(',', sort qw(
42 $compare = lc($compare);
43 $result = join(',', sort values %pods);
44 my $undollared = $Qlib_dir;
45 $undollared =~ s/\$/\\\$/g;
46 $undollared =~ s/\-/\\\-/g;
47 $result =~ s/$undollared/pod::/g;
49 my @result = split(/,/,$result);
50 my @compare = split(/,/,$compare);
52 $count += grep {/$_/} @result;
54 ok($count/($#result+1)-1,$#compare);
56 elsif ($^O eq 'dos') {
57 ok(lc $result,lc $compare);
64 print "### searching for File::Find\n";
65 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
66 || 'undef - pod not found!';
67 print "### found $result\n";
70 if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
71 $compare = "lib.File]Find.pm";
72 $result =~ s/perl_root:\[\-?\.?//i;
73 $result =~ s/\[\-?\.?//i; # needed under `mms test`
77 $compare = File::Spec->catfile(File::Spec->updir, 'lib','File','Find.pm');
78 ok(_canon($result),_canon($compare));
81 # Search for a documentation pod rather than a module
82 print "### searching for Stuff.pod\n";
83 my $search = File::Spec->catdir('pod', 'testpods', 'lib', 'Pod');
84 $result = pod_where({ -dirs => [$search], -verbose => $VERBOSE }, 'Stuff')
85 || 'undef - Stuff.pod not found!';
86 print "### found $result\n";
88 $compare = File::Spec->catfile('pod', 'testpods', 'lib', 'Pod' ,'Stuff.pod');
89 ok(_canon($result),_canon($compare));
91 # make the path as generic as possible
95 $path = File::Spec->canonpath($path);
96 my @comp = File::Spec->splitpath($path);
97 my @dir = File::Spec->splitdir($comp[1]);
98 $comp[1] = File::Spec->catdir(@dir);
99 $path = File::Spec->catpath(@dir);
100 $path = uc($path) if File::Spec->case_tolerant;