10 #sub Pod::Simple::Search::DEBUG () {5};
12 use Pod::Simple::Search;
14 BEGIN { plan tests => 10 }
17 ": Testing limit_glob ...\n";
19 my $x = Pod::Simple::Search->new;
20 die "Couldn't make an object!?" unless ok defined $x;
28 print "# CWD: $cwd\n";
32 if ($ENV{PERL_CORE}) {
33 my $updir = File::Spec->updir;
34 $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't');
35 return File::Spec->catdir ($dir, $file);
41 my($here1, $here2, $here3);
43 if( -e ($here1 = source_path( 'testlib1' ))) {
44 die "But where's $here2?"
45 unless -e ($here2 = source_path( 'testlib2'));
46 die "But where's $here3?"
47 unless -e ($here3 = source_path( 'testlib3'));
49 } elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'testlib1' ))) {
50 die "But where's $here2?"
51 unless -e ($here2 = File::Spec->catdir($cwd, 't', 'testlib2'));
52 die "But where's $here3?"
53 unless -e ($here3 = File::Spec->catdir($cwd, 't', 'testlib3'));
56 die "Can't find the test corpora: $dir";
58 print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n";
61 print $x->_state_as_string;
65 *pretty = \&Pod::Simple::BlackBox::pretty;
67 my $glob = 'squaa::*';
68 print "# Limiting to $glob\n";
69 $x->limit_glob($glob);
71 my($name2where, $where2name) = $x->survey($here1, $here2, $here3);
73 my $p = pretty( $where2name, $name2where )."\n";
79 my $names = join "|", sort keys %$name2where;
80 ok $names, "squaa::Glunk|squaa::Vliff|squaa::Wowo";
84 my $names = join "|", sort values %$where2name;
85 ok $names, "squaa::Glunk|squaa::Vliff|squaa::Vliff|squaa::Vliff|squaa::Wowo";
88 for(values %$where2name) { ++$count{$_} };
89 #print pretty(\%count), "\n\n";
90 delete @count{ grep $count{$_} < 2, keys %count };
91 my $shadowed = join "|", sort keys %count;
92 ok $shadowed, "squaa::Vliff";
94 sub thar { print "# Seen $_[0] :\n", map "# {$_}\n", sort grep $where2name->{$_} eq $_[0],keys %$where2name; return; }
96 ok $count{'squaa::Vliff'}, 3;
101 ok ! $name2where->{'squaa'}; # because squaa.pm isn't squaa::*
103 ok( ($name2where->{'squaa::Vliff'} || 'huh???'), '/[^\^]testlib1/' );
105 ok( ($name2where->{'squaa::Wowo'} || 'huh???'), '/testlib2/' );
108 print "# OK, bye from ", __FILE__, "\n";