2 if( $ENV{PERL_CORE} ) {
5 @INC = (File::Spec->rel2abs('../lib') );
10 #sub Pod::Simple::Search::DEBUG () {5};
12 use Pod::Simple::Search;
14 BEGIN { plan tests => 8 }
16 print "# Test the scanning of the whole of \@INC ...\n";
18 my $x = Pod::Simple::Search->new;
19 die "Couldn't make an object!?" unless ok defined $x;
20 ok $x->inc; # make sure inc=1 is the default
21 print $x->_state_as_string;
25 *pretty = \&Pod::Simple::BlackBox::pretty;
29 print "# ", join(" ", map "{$_}", @_), "\n";
34 print "# \@INC == @INC\n";
36 my $t = time(); my($name2where, $where2name) = $x->survey();
40 print "# Found $found items in $t seconds!\n# See...\n";
42 my $p = pretty( $where2name, $name2where )."\n";
47 print "# OK, making sure strict and strict.pm were in there...\n";
48 print "# (On Debian-based distributions Pod is stripped from\n",
49 "# strict.pm, so skip these tests.)\n";
50 my $nopod = not exists ($name2where->{'strict'});
51 skip($nopod, ($name2where->{'strict'} || 'huh???'), '/strict\.(pod|pm)$/');
53 skip($nopod, grep( m/strict\.(pod|pm)/, keys %$where2name ));
55 my $strictpath = $name2where->{'strict'};
57 my @x = ($x->find('strict')||'(nil)', $strictpath);
58 print "# Comparing \"$x[0]\" to \"$x[1]\"\n";
59 for(@x) { s{[/\\]}{/}g; }
60 print "# => \"$x[0]\" to \"$x[1]\"\n";
61 ok $x[0], $x[1], " find('strict') should match survey's name2where{strict}";
63 skip "skipping find() for strict.pm"; # skipping find() for 'thatpath/strict.pm
65 ok 0; # an entry without a defined path means can't test find()
68 print "# Test again on a module we know is present, in case the
69 strict.pm tests were skipped...\n";
71 # Grab the first item in $name2where, since it doesn't matter which we
73 my $testmod = (keys %$name2where)[0];
74 my $testpath = $name2where->{$testmod};
76 my @x = ($x->find($testmod)||'(nil)', $testpath);
77 print "# Comparing \"$x[0]\" to \"$x[1]\"\n";
78 for(@x) { s{[/\\]}{/}g; }
79 print "# => \"$x[0]\" to \"$x[1]\"\n";
80 ok $x[0], $x[1], " find('$testmod') should match survey's name2where{$testmod}";
82 ok 0; # no 'thatpath/<name>.pm' means can't test find()
86 print "# Byebye from ", __FILE__, "\n";