2 # Author: Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
18 use Pod::Find qw(pod_find pod_where);
25 my $lib_dir = File::Spec->catdir('pod', 'testpods', 'lib');
27 $lib_dir = VMS::Filespec::unixify(File::Spec->catdir('pod', 'testpods', 'lib'));
29 $Qlib_dir =~ s#\/#::#g;
31 print "### searching $lib_dir\n";
32 my %pods = pod_find($lib_dir);
33 my $result = join(',', sort values %pods);
34 my $compare = join(',', sort qw(
38 $compare = lc($compare);
39 $result = join(',', sort values %pods);
40 my $undollared = $Qlib_dir;
41 $undollared =~ s/\$/\\\$/g;
42 $undollared =~ s/\-/\\\-/g;
43 $result =~ s/$undollared/pod::/g;
45 my @result = split(/,/,$result);
46 my @compare = split(/,/,$compare);
48 $count += grep {/$_/} @result;
50 ok($count/($#result+1)-1,$#compare);
57 print "### searching for File::Find\n";
58 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
59 || 'undef - pod not found!';
60 print "### found $result\n";
63 if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
64 $compare = "lib.File]Find.pm";
65 $result =~ s/perl_root:\[\-?\.?//i;
66 $result =~ s/\[\-?\.?//i; # needed under `mms test`
70 $compare = File::Spec->catfile(File::Spec->updir, 'lib','File','Find.pm');
71 ok(_canon($result),_canon($compare));
74 # Search for a documentation pod rather than a module
75 print "### searching for Stuff.pod\n";
76 my $search = File::Spec->catdir('pod', 'testpods', 'lib', 'Pod');
77 $result = pod_where({ -dirs => [$search], -verbose => $VERBOSE }, 'Stuff')
78 || 'undef - Stuff.pod not found!';
79 print "### found $result\n";
81 $compare = File::Spec->catfile('pod', 'testpods', 'lib', 'Pod' ,'Stuff.pod');
82 ok(_canon($result),_canon($compare));
84 # make the path as generic as possible
88 $path = File::Spec->canonpath($path);
89 my @comp = File::Spec->splitpath($path);
90 my @dir = File::Spec->splitdir($comp[1]);
91 $comp[1] = File::Spec->catdir(@dir);
92 $path = File::Spec->catpath(@dir);
93 $path = uc($path) if File::Spec->case_tolerant;