Upgrade to Pod-Simple-3.05.
[p5sagit/p5-mst-13.2.git] / lib / Pod / Simple / t / search26.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 => 5 }
12
13
14#
15# "kleene" rhymes with "zany". It's a fact!
16#
17
18
19print "# ", __FILE__,
20 ": Testing limit_glob ...\n";
21
22my $x = Pod::Simple::Search->new;
23die "Couldn't make an object!?" unless ok defined $x;
24
25$x->inc(0);
26$x->shadows(1);
27
28use File::Spec;
29use Cwd;
30my $cwd = cwd();
31print "# CWD: $cwd\n";
32
33sub source_path {
34 my $file = shift;
35 if ($ENV{PERL_CORE}) {
36 my $updir = File::Spec->updir;
37 my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't');
38 return File::Spec->catdir ($dir, $file);
39 } else {
40 return $file;
41 }
42}
43
44my($here1, $here2, $here3);
45
318efef0 46if( -e ($here1 = source_path( 'test_lib' ))) {
351625bd 47 die "But where's $here2?"
318efef0 48 unless -e ($here2 = source_path ( 'other_test_lib'));
351625bd 49 die "But where's $here3?"
318efef0 50 unless -e ($here3 = source_path( 'yet_another_test_lib'));
351625bd 51
318efef0 52} elsif( -e ($here1 = File::Spec->catdir($cwd, 't', 'test_lib' ))) {
351625bd 53 die "But where's $here2?"
318efef0 54 unless -e ($here2 = File::Spec->catdir($cwd, 't', 'other_test_lib'));
351625bd 55 die "But where's $here3?"
318efef0 56 unless -e ($here3 = File::Spec->catdir($cwd, 't', 'yet_another_test_lib'));
351625bd 57
58} else {
59 die "Can't find the test corpora";
60}
61print "# OK, found the test corpora\n# as $here1\n# and $here2\n# and $here3\n#\n";
62ok 1;
63
64print $x->_state_as_string;
65#$x->verbose(12);
66
67use Pod::Simple;
68*pretty = \&Pod::Simple::BlackBox::pretty;
69
70my $glob = '*k';
71print "# Limiting to $glob\n";
72$x->limit_glob($glob);
73
74my($name2where, $where2name) = $x->survey($here1, $here2, $here3);
75
76my $p = pretty( $where2name, $name2where )."\n";
77$p =~ s/, +/,\n/g;
78$p =~ s/^/# /mg;
79print $p;
80
81{
82my $names = join "|", sort keys %$name2where;
318efef0 83ok $names, "Zonk::Pronk|hink_honk::Glunk|perlzuk|squaa::Glunk|zikzik";
351625bd 84}
85
86{
87my $names = join "|", sort values %$where2name;
318efef0 88ok $names, "Zonk::Pronk|hink_honk::Glunk|hink_honk::Glunk|perlzuk|squaa::Glunk|zikzik";
351625bd 89}
90
91print "# OK, bye from ", __FILE__, "\n";
92ok 1;
93
94__END__
95