Changes to Pod::Simple's tests to get rid of the "^"s in the
[p5sagit/p5-mst-13.2.git] / lib / Pod / Simple / t / search_20survey_two.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 scanning of several (well, two) docroots...\n";
15
16my $x = Pod::Simple::Search->new;
17die "Couldn't make an object!?" unless ok defined $x;
18
19$x->inc(0);
20
21$x->callback(sub {
22 print "# ", join(" ", map "{$_}", @_), "\n";
23 return;
24});
25
26use File::Spec;
27use Cwd;
28my $cwd = cwd();
29print "# CWD: $cwd\n";
30
31sub source_path {
32 my $file = shift;
33 if ($ENV{PERL_CORE}) {
34 my $updir = File::Spec->updir;
35 my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't');
36 return File::Spec->catdir ($dir, $file);
37 } else {
38 return $file;
39 }
40}
41
42my($here1, $here2);
318efef0 43if( -e ($here1 = source_path('test_lib'))) {
351625bd 44 die "But where's $here2?"
318efef0 45 unless -e ($here2 = source_path('other_test_lib'));
46} elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'test_lib' ))) {
351625bd 47 die "But where's $here2?"
318efef0 48 unless -e ($here2 = File::Spec->catdir($cwd, 't', 'other_test_lib'));
351625bd 49} else {
50 die "Can't find the test corpora";
51}
52print "# OK, found the test corpora\n# as $here1\n# and $here2\n";
53ok 1;
54
55print $x->_state_as_string;
56#$x->verbose(12);
57
58use Pod::Simple;
59*pretty = \&Pod::Simple::BlackBox::pretty;
60
61print "# OK, starting run...\n# [[\n";
62my($name2where, $where2name) = $x->survey($here1, $here2);
63print "# ]]\n#OK, run done.\n";
64
65my $p = pretty( $where2name, $name2where )."\n";
66$p =~ s/, +/,\n/g;
67$p =~ s/^/# /mg;
68print $p;
69
70{
71my $names = join "|", sort values %$where2name;
318efef0 72ok $names, "Blorm|Sizzlesuzzle|Zonk::Pronk|hink_honk::Glunk|hink_honk::Vliff|perlfliff|perlthang|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo|zikzik";
351625bd 73}
74
75{
76my $names = join "|", sort keys %$name2where;
318efef0 77ok $names, "Blorm|Sizzlesuzzle|Zonk::Pronk|hink_honk::Glunk|hink_honk::Vliff|perlfliff|perlthang|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo|zikzik";
351625bd 78}
79
80ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/');
81
82ok grep( m/squaa\.pm/, keys %$where2name ), 1;
83
84ok 1;
85
86__END__
87