3
use Pod::Simple::Search;
5
BEGIN { plan tests => 10 }
8
": Testing limit_glob ...\n";
10
my $x = Pod::Simple::Search->new;
11
die "Couldn't make an object!?" unless ok defined $x;
19
print "# CWD: $cwd\n";
21
my($here1, $here2, $here3);
23
if( -e ($here1 = File::Spec->catdir($cwd, 'test^lib' ))) {
24
die "But where's $here2?"
25
unless -e ($here2 = File::Spec->catdir($cwd, 'other^test^lib'));
26
die "But where's $here3?"
27
unless -e ($here3 = File::Spec->catdir($cwd, 'yet^another^test^lib'));
29
} elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'test^lib' ))) {
30
die "But where's $here2?"
31
unless -e ($here2 = File::Spec->catdir($cwd, 't', 'other^test^lib'));
32
die "But where's $here3?"
33
unless -e ($here3 = File::Spec->catdir($cwd, 't', 'yet^another^test^lib'));
36
die "Can't find the test corpora";
38
print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n";
41
print $x->_state_as_string;
45
*pretty = \&Pod::Simple::BlackBox::pretty;
48
print "# Limiting to $glob\n";
49
$x->limit_glob($glob);
51
my($name2where, $where2name) = $x->survey($here1, $here2, $here3);
53
my $p = pretty( $where2name, $name2where )."\n";
59
my $names = join "|", sort keys %$name2where;
60
ok $names, "squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo";
64
my $names = join "|", sort values %$where2name;
65
ok $names, "squaa|squaa::Glunk|squaa::Vliff|squaa::Vliff|squaa::Vliff|squaa::Wowo";
68
for(values %$where2name) { ++$count{$_} };
69
#print pretty(\%count), "\n\n";
70
delete @count{ grep $count{$_} < 2, keys %count };
71
my $shadowed = join "|", sort keys %count;
72
ok $shadowed, "squaa::Vliff";
74
sub thar { print "# Seen $_[0] :\n", map "# {$_}\n", sort grep $where2name->{$_} eq $_[0],keys %$where2name; return; }
76
ok $count{'squaa::Vliff'}, 3;
81
ok $name2where->{'squaa'}; # because squaa.pm IS squaa*
83
ok( ($name2where->{'squaa::Vliff'} || 'huh???'), '/[^\^]test\^lib/' );
85
ok( ($name2where->{'squaa::Wowo'} || 'huh???'), '/other\^test\^lib/' );
88
print "# OK, bye from ", __FILE__, "\n";