2 # Author: Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
13 use Pod::Find qw(pod_find pod_where);
20 my $lib_dir = File::Spec->catdir('pod', 'testpods', 'lib');
22 $lib_dir = VMS::Filespec::unixify(File::Spec->catdir('pod', 'testpods', 'lib'));
24 $Qlib_dir =~ s#\/#::#g;
26 print "### searching $lib_dir\n";
27 my %pods = pod_find($lib_dir);
28 my $result = join(',', sort values %pods);
29 my $compare = join(',', sort qw(
33 $compare = lc($compare);
34 $result = join(',', sort values %pods);
35 my $undollared = $Qlib_dir;
36 $undollared =~ s/\$/\\\$/g;
37 $undollared =~ s/\-/\\\-/g;
38 $result =~ s/$undollared/pod::/g;
40 my @result = split(/,/,$result);
41 my @compare = split(/,/,$compare);
43 $count += grep {/$_/} @result;
45 ok($count/($#result+1)-1,$#compare);
52 print "### searching for File::Find\n";
53 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
54 || 'undef - pod not found!';
55 print "### found $result\n";
58 if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
59 $compare = "lib.File]Find.pm";
60 $result =~ s/perl_root:\[\-?\.?//i;
61 $result =~ s/\[\-?\.?//i; # needed under `mms test`
65 $compare = File::Spec->catfile(File::Spec->updir, 'lib','File','Find.pm');
66 ok(_canon($result),_canon($compare));
69 # Search for a documentation pod rather than a module
70 print "### searching for Stuff.pod\n";
71 my $search = File::Spec->catdir('pod', 'testpods', 'lib', 'Pod');
72 $result = pod_where({ -dirs => [$search], -verbose => $VERBOSE }, 'Stuff')
73 || 'undef - Stuff.pod not found!';
74 print "### found $result\n";
76 $compare = File::Spec->catfile('pod', 'testpods', 'lib', 'Pod' ,'Stuff.pod');
77 ok(_canon($result),_canon($compare));
79 # make the path as generic as possible
83 $path = File::Spec->canonpath($path);
84 my @comp = File::Spec->splitpath($path);
85 my @dir = File::Spec->splitdir($comp[1]);
86 $comp[1] = File::Spec->catdir(@dir);
87 $path = File::Spec->catpath(@dir);
88 $path = uc($path) if File::Spec->case_tolerant;