1use strict; 2use warnings; 3use Test::More tests => 9; 4 5use Pod::Simple::Search; 6 7print "# ", __FILE__, 8 ": Testing the surveying of the current directory...\n"; 9 10my $x = Pod::Simple::Search->new; 11die "Couldn't make an object!?" unless ok defined $x; 12 13$x->inc(0); 14 15use File::Spec; 16use Cwd (); 17use File::Basename (); 18 19my $t_dir = File::Basename::dirname(Cwd::abs_path(__FILE__)); 20 21my $here = File::Spec->catdir($t_dir, 'testlib1'); 22 23print "# OK, found the test corpus as $here\n"; 24 25print $x->_state_as_string; 26#$x->verbose(12); 27 28use Pod::Simple; 29*pretty = \&Pod::Simple::BlackBox::pretty; 30 31my($name2where, $where2name) = $x->survey($here); 32 33my $p = pretty( $where2name, $name2where )."\n"; 34$p =~ s/, +/,\n/g; 35$p =~ s/^/# /mg; 36print $p; 37 38require File::Spec->catfile($t_dir, 'ascii_order.pl'); 39 40{ 41my $names = join "|", sort ascii_order values %$where2name; 42is $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; 43} 44 45{ 46my $names = join "|", sort ascii_order keys %$name2where; 47is $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; 48} 49 50like( ($name2where->{'squaa'} || 'huh???'), qr/squaa\.pm$/); 51 52is grep( m/squaa\.pm/, keys %$where2name ), 1; 53 54###### Now with recurse(0) 55 56print "# Testing the surveying of a subdirectory with recursing off...\n"; 57 58$x->recurse(0); 59($name2where, $where2name) = $x->survey( 60 File::Spec->catdir($t_dir, 'testlib2')); 61 62$p = pretty( $where2name, $name2where )."\n"; 63$p =~ s/, +/,\n/g; 64$p =~ s/^/# /mg; 65print $p; 66 67{ 68my $names = lc join "|", sort ascii_order values %$where2name; 69is $names, "suzzle"; 70} 71 72{ 73my $names = lc join "|", sort ascii_order keys %$name2where; 74is $names, "suzzle"; 75} 76 77is( ($name2where->{'Vliff'} || 'huh???'), 'huh???'); 78 79is grep( m/Vliff\.pm/, keys %$where2name ), 0; 80