This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add a few missing files, update MANIFEST.
[perl5.git] / t / pod / find.t
CommitLineData
7b43481a
JH
1# Testing of Pod::Find
2# Author: Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
3
4$| = 1;
5
6use Test;
7
8BEGIN { plan tests => 4 }
9
10use Pod::Find qw(pod_find pod_where);
11use File::Spec;
12
13# load successful
14ok(1);
15
16require Cwd;
17my $THISDIR = Cwd::cwd();
18my $VERBOSE = 0;
19
20print "*** searching $THISDIR/lib\n";
21my %pods = pod_find("$THISDIR/lib");
22my $result = join(',', sort values %pods);
23print "*** found $result\n";
24my $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));
34ok($result,$compare);
35
36# File::Find is located in this place since eons
37# and on all platforms, hopefully
38
39print "*** searching for File::Find\n";
40$result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
41 || 'undef - pod not found!';
42print "*** found $result\n";
43
44require Config;
45$compare = File::Spec->catfile($Config::Config{privlib},"File","Find.pm");
46ok(_canon($result),_canon($compare));
47
48# Search for a documentation pod rather than a module
49print "*** searching for perlfunc.pod\n";
50$result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'perlfunc')
51 || 'undef - perlfunc.pod not found!';
52print "*** found $result\n";
53
54$compare = File::Spec->catfile($Config::Config{privlib},"perlfunc.pod");
55ok(_canon($result),_canon($compare));
56
57# make the path as generic as possible
58sub _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