xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Simple/t/search29.t (revision 5486feefcc8cb79b19e014ab332cc5dfd05b3b33)
1b39c5158Smillertuse strict;
2256a93a4Safresh1use warnings;
3b39c5158Smillertuse Pod::Simple::Search;
4*5486feefSafresh1use Test::More tests => 2;
5b39c5158Smillert
6b39c5158Smillertprint "# ", __FILE__,
7b39c5158Smillert ": Testing limit_glob ...\n";
8b39c5158Smillert
9b39c5158Smillertmy $x = Pod::Simple::Search->new;
10b39c5158Smillertdie "Couldn't make an object!?" unless ok defined $x;
11b39c5158Smillert
12b39c5158Smillert$x->inc(0);
13b39c5158Smillert$x->shadows(1);
14b39c5158Smillert
15b39c5158Smillertuse File::Spec;
16*5486feefSafresh1use Cwd ();
17*5486feefSafresh1use File::Basename ();
18b39c5158Smillert
19*5486feefSafresh1my $t_dir = File::Basename::dirname(Cwd::abs_path(__FILE__));
20b39c5158Smillert
21*5486feefSafresh1my $here1 = File::Spec->catdir($t_dir, 'testlib1');
22*5486feefSafresh1my $here2 = File::Spec->catdir($t_dir, 'testlib2');
23*5486feefSafresh1my $here3 = File::Spec->catdir($t_dir, 'testlib3');
24b39c5158Smillert
25b39c5158Smillertprint "# OK, found the test corpora\n#  as $here1\n# and $here2\n# and $here3\n#\n";
26b39c5158Smillert
27b39c5158Smillertprint $x->_state_as_string;
28b39c5158Smillert#$x->verbose(12);
29b39c5158Smillert
30b39c5158Smillertuse Pod::Simple;
31b39c5158Smillert*pretty = \&Pod::Simple::BlackBox::pretty;
32b39c5158Smillert
33b39c5158Smillertmy $glob = '*z?k*';
34b39c5158Smillertprint "# Limiting to $glob\n";
35b39c5158Smillert$x->limit_glob($glob);
36b39c5158Smillert
37b39c5158Smillertmy($name2where, $where2name) = $x->survey($here1, $here2, $here3);
38b39c5158Smillert
39b39c5158Smillertmy $p = pretty( $where2name, $name2where )."\n";
40b39c5158Smillert$p =~ s/, +/,\n/g;
41b39c5158Smillert$p =~ s/^/#  /mg;
42b39c5158Smillertprint $p;
43b39c5158Smillert
44b39c5158Smillert{
45b39c5158Smillertmy $names = join "|", sort values %$where2name;
46*5486feefSafresh1is $names, "perlzuk|zikzik";
47b39c5158Smillert}
48