2 # Author: Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
8 BEGIN { plan tests => 4 }
10 use Pod::Find qw(pod_find pod_where);
17 my $THISDIR = Cwd::cwd();
19 my $lib_dir = File::Spec->catdir($THISDIR,'lib');
21 $lib_dir = VMS::Filespec::unixify(File::Spec->catdir($THISDIR,'-','lib','pod'));
23 $Qlib_dir =~ s#\/#::#g;
25 print "### searching $lib_dir\n";
26 my %pods = pod_find("$lib_dir");
27 my $result = join("\n### ", sort values %pods);
28 print "### found $result\n";
29 my $compare = join(',', qw(
40 $compare = lc($compare);
41 $result = join(',', sort grep(/pod::/, values %pods));
42 my $undollared = $Qlib_dir;
43 $undollared =~ s/\$/\\\$/g;
44 $undollared =~ s/\-/\\\-/g;
45 $result =~ s/$undollared/pod::/g;
47 my @result = split(/,/,$result);
48 my @compare = split(/,/,$compare);
50 $count += grep {/$_/} @result;
52 ok($count/($#result+1)-1,$#compare);
58 # File::Find is located in this place since eons
59 # and on all platforms, hopefully
61 print "### searching for File::Find\n";
62 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
63 || 'undef - pod not found!';
64 print "### found $result\n";
67 if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
68 $compare = "lib.File]Find.pm";
69 $result =~ s/perl_root:\[\-?\.?//i;
70 $result =~ s/\[\-?\.?//i; # needed under `mms test`
74 $compare = File::Spec->catfile($Config::Config{privlib},"File","Find.pm");
75 ok(_canon($result),_canon($compare));
78 # Search for a documentation pod rather than a module
79 print "### searching for perlfunc.pod\n";
80 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'perlfunc')
81 || 'undef - perlfunc.pod not found!';
82 print "### found $result\n";
84 if ($^O eq 'VMS') { # privlib is perl_root:[lib] unfortunately
85 $compare = "/lib/pod/perlfunc.pod";
86 $result = VMS::Filespec::unixify($result);
87 $result =~ s/perl_root\///i;
88 $result =~ s/^\.\.//; # needed under `mms test`
92 $compare = File::Spec->catfile($Config::Config{privlib},"perlfunc.pod");
93 ok(_canon($result),_canon($compare));
96 # make the path as generic as possible
100 $path = File::Spec->canonpath($path);
101 my @comp = File::Spec->splitpath($path);
102 my @dir = File::Spec->splitdir($comp[1]);
103 $comp[1] = File::Spec->catdir(@dir);
104 $path = File::Spec->catpath(@dir);
105 $path = uc($path) if File::Spec->case_tolerant;