on windows, the return values from wait() and waitpid() don't
[p5sagit/p5-mst-13.2.git] / t / pod / find.t
1 # Testing of Pod::Find
2 # Author: Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
3
4 $| = 1;
5
6 use Test;
7
8 BEGIN { plan tests => 4 }
9
10 use Pod::Find qw(pod_find pod_where);
11 use File::Spec;
12
13 # load successful
14 ok(1);
15
16 require Cwd;
17 my $THISDIR = Cwd::cwd();
18 my $VERBOSE = 0;
19
20 print "*** searching $THISDIR/lib\n";
21 my %pods = pod_find("$THISDIR/lib");
22 my $result = join(',', sort values %pods);
23 print "*** found $result\n";
24 my $compare = join(',', qw(
25     Pod::Checker
26     Pod::Find
27     Pod::InputObjects
28     Pod::ParseUtils
29     Pod::Parser
30     Pod::PlainText
31     Pod::Select
32     Pod::Usage
33 ));
34 ok($result,$compare);
35
36 # File::Find is located in this place since eons
37 # and on all platforms, hopefully
38
39 print "*** searching for File::Find\n";
40 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
41   || 'undef - pod not found!';
42 print "*** found $result\n";
43
44 require Config;
45 $compare = File::Spec->catfile($Config::Config{privlib},"File","Find.pm");
46 ok(_canon($result),_canon($compare));
47
48 # Search for a documentation pod rather than a module
49 print "*** searching for perlfunc.pod\n";
50 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'perlfunc')
51   || 'undef - perlfunc.pod not found!';
52 print "*** found $result\n";
53
54 $compare =  File::Spec->catfile($Config::Config{privlib},"perlfunc.pod");
55 ok(_canon($result),_canon($compare));
56
57 # make the path as generic as possible
58 sub _canon
59 {
60   my ($path) = @_;
61   $path = File::Spec->canonpath($path);
62   my @comp = File::Spec->splitpath($path);
63   my @dir = File::Spec->splitdir($comp[1]);
64   $comp[1] = File::Spec->catdir(@dir);
65   $path = File::Spec->catpath(@dir);
66   $path = uc($path) if File::Spec->case_tolerant;
67   $path;
68 }
69