Additional test file edits needed for Pod-Simple-3.05 that couldn't
[p5sagit/p5-mst-13.2.git] / lib / Pod / Simple / t / search12.t
CommitLineData
351625bd 1BEGIN {
2 if($ENV{PERL_CORE}) {
3 chdir 't';
4 @INC = '../lib';
5 }
6}
7
8use strict;
9use Pod::Simple::Search;
10use Test;
11BEGIN { plan tests => 7 }
12
13print "# ", __FILE__,
14 ": Testing the surveying of the current directory...\n";
15
16my $x = Pod::Simple::Search->new;
17die "Couldn't make an object!?" unless ok defined $x;
18
19$x->inc(0);
20
21use File::Spec;
22use Cwd;
23my $cwd = cwd();
24print "# CWD: $cwd\n";
25
26sub source_path {
27 my $file = shift;
28 if ($ENV{PERL_CORE}) {
29 require File::Spec;
30 my $updir = File::Spec->updir;
31 my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't');
32 return File::Spec->catdir ($dir, $file);
33 } else {
34 return $file;
35 }
36}
37
38my $here;
9b134129 39if( -e ($here = source_path('testlib1'))) {
351625bd 40 chdir $here;
9b134129 41} elsif(-e ($here = File::Spec->catdir($cwd, 't', 'testlib1'))) {
351625bd 42 chdir $here;
43} else {
44 die "Can't find the test corpus";
45}
46print "# OK, found the test corpus as $here\n";
47ok 1;
48
49print $x->_state_as_string;
50#$x->verbose(12);
51
52use Pod::Simple;
53*pretty = \&Pod::Simple::BlackBox::pretty;
54
55my($name2where, $where2name) = $x->survey('.');
56
57my $p = pretty( $where2name, $name2where )."\n";
58$p =~ s/, +/,\n/g;
59$p =~ s/^/# /mg;
60print $p;
61
62{
63my $names = join "|", sort values %$where2name;
9b134129 64ok $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik";
351625bd 65}
66
67{
68my $names = join "|", sort keys %$name2where;
9b134129 69ok $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik";
351625bd 70}
71
72ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/');
73
74ok grep( m/squaa\.pm/, keys %$where2name ), 1;
75
76ok 1;
77
78__END__
79