9 use Pod::Simple::Search;
11 BEGIN { plan tests => 13 }
14 ": Testing the scanning of several docroots...\n";
16 my $x = Pod::Simple::Search->new;
17 die "Couldn't make an object!?" unless ok defined $x;
25 print "# CWD: $cwd\n";
29 if ($ENV{PERL_CORE}) {
30 my $updir = File::Spec->updir;
31 my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't');
32 return File::Spec->catdir ($dir, $file);
38 my($here1, $here2, $here3);
40 if( -e ($here1 = source_path('test_lib' ))) {
41 die "But where's $here2?"
42 unless -e ($here2 = source_path('other_test_lib'));
43 die "But where's $here3?"
44 unless -e ($here3 = source_path('yet_another_test_lib'));
46 } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'test_lib' ))) {
47 die "But where's $here2?"
48 unless -e ($here2 = File::Spec->catdir($cwd, 't', 'other_test_lib'));
49 die "But where's $here3?"
50 unless -e ($here3 = File::Spec->catdir($cwd, 't', 'yet_another_test_lib'));
53 die "Can't find the test corpora";
55 print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n";
58 print $x->_state_as_string;
62 *pretty = \&Pod::Simple::BlackBox::pretty;
64 my($name2where, $where2name) = $x->survey($here1, $here2, $here3);
66 my $p = pretty( $where2name, $name2where )."\n";
72 print "# won't show any shadows, since we're just looking at the name2where keys\n";
73 my $names = join "|", sort keys %$name2where;
74 ok $names, "Blorm|Sizzlesuzzle|Zonk::Pronk|hink_honk::Glunk|hink_honk::Vliff|perlfliff|perlthang|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo|zikzik";
78 print "# but here we'll see shadowing:\n";
79 my $names = join "|", sort values %$where2name;
80 ok $names, "Blorm|Sizzlesuzzle|Zonk::Pronk|hink_honk::Glunk|hink_honk::Glunk|hink_honk::Vliff|hink_honk::Vliff|perlfliff|perlthang|perlthang|perlzuk|squaa|squaa::Glunk|squaa::Vliff|squaa::Vliff|squaa::Vliff|squaa::Wowo|zikzik";
83 for(values %$where2name) { ++$count{$_} };
84 #print pretty(\%count), "\n\n";
85 delete @count{ grep $count{$_} < 2, keys %count };
86 my $shadowed = join "|", sort keys %count;
87 ok $shadowed, "hink_honk::Glunk|hink_honk::Vliff|perlthang|squaa::Vliff";
89 sub thar { print "# Seen $_[0] :\n", map "# {$_}\n", sort grep $where2name->{$_} eq $_[0],keys %$where2name; return; }
91 ok $count{'perlthang'}, 2;
93 ok $count{'squaa::Vliff'}, 3;
98 ok( ($name2where->{'squaa'} || 'huh???'), '/squaa\.pm$/');
100 ok grep( m/squaa\.pm/, keys %$where2name ), 1;
102 ok( ($name2where->{'perlthang'} || 'huh???'), '/[^\^]test_lib/' );
103 ok( ($name2where->{'squaa::Vliff'} || 'huh???'), '/[^\^]test_lib/' );
106 ok( ($name2where->{'squaa::Wowo'} || 'huh???'), '/other_test_lib/' );
111 print "# OK, bye from ", __FILE__, "\n";