1b39c5158Smillertuse strict; 2eac174f2Safresh1use warnings; 3*3d61058aSafresh1use Test::More tests => 9; 4b39c5158Smillert 5b39c5158Smillert#sub Pod::Simple::Search::DEBUG () {5}; 6b39c5158Smillert 7b39c5158Smillertuse Pod::Simple::Search; 8b39c5158Smillert 9b39c5158Smillertprint "# ", __FILE__, 10b39c5158Smillert ": Testing the surveying of a single specified docroot...\n"; 11b39c5158Smillert 12b39c5158Smillertmy $x = Pod::Simple::Search->new; 13b39c5158Smillertdie "Couldn't make an object!?" unless ok defined $x; 14b39c5158Smillert 15b39c5158Smillert$x->inc(0); 16b39c5158Smillert 17b39c5158Smillertuse File::Spec; 18*3d61058aSafresh1use Cwd (); 19*3d61058aSafresh1use File::Basename (); 20b39c5158Smillert 21*3d61058aSafresh1my $t_dir = File::Basename::dirname(Cwd::abs_path(__FILE__)); 22b39c5158Smillert 23*3d61058aSafresh1my $here = File::Spec->catdir($t_dir, 'testlib1'); 24*3d61058aSafresh1 25b39c5158Smillertprint "# OK, found the test corpus as $here\n"; 26b39c5158Smillert 27b39c5158Smillertprint $x->_state_as_string; 28b39c5158Smillert#$x->verbose(12); 29b39c5158Smillert 30b39c5158Smillertuse Pod::Simple; 31b39c5158Smillert*pretty = \&Pod::Simple::BlackBox::pretty; 32b39c5158Smillert 33b39c5158Smillertmy($name2where, $where2name) = $x->survey($here); 34b39c5158Smillert 35b39c5158Smillertmy $p = pretty( $where2name, $name2where )."\n"; 36b39c5158Smillert$p =~ s/, +/,\n/g; 37b39c5158Smillert$p =~ s/^/# /mg; 38b39c5158Smillertprint $p; 39b39c5158Smillert 40*3d61058aSafresh1require File::Spec->catfile($t_dir, 'ascii_order.pl'); 41b8851fccSafresh1 42b39c5158Smillert{ 43b8851fccSafresh1my $names = join "|", sort ascii_order values %$where2name; 44*3d61058aSafresh1is $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; 45b39c5158Smillert} 46b39c5158Smillert 47b39c5158Smillert{ 48b8851fccSafresh1my $names = join "|", sort ascii_order keys %$name2where; 49*3d61058aSafresh1is $names, "Blorm|Zonk::Pronk|hinkhonk::Glunk|hinkhonk::Vliff|perlflif|perlthng|squaa|squaa::Glunk|squaa::Vliff|zikzik"; 50b39c5158Smillert} 51b39c5158Smillert 52*3d61058aSafresh1like( ($name2where->{'squaa'} || 'huh???'), qr/squaa\.pm$/); 53b39c5158Smillert 54*3d61058aSafresh1is grep( m/squaa\.pm/, keys %$where2name ), 1; 55b39c5158Smillert 56898184e3Ssthen###### Now with recurse(0) 57898184e3Ssthen 58898184e3Ssthenprint "# Testing the surveying of a single docroot without recursing...\n"; 59898184e3Ssthen 60898184e3Ssthen$x->recurse(0); 61898184e3Ssthen($name2where, $where2name) = $x->survey($here); 62898184e3Ssthen 63898184e3Ssthen$p = pretty( $where2name, $name2where )."\n"; 64898184e3Ssthen$p =~ s/, +/,\n/g; 65898184e3Ssthen$p =~ s/^/# /mg; 66898184e3Ssthenprint $p; 67898184e3Ssthen 68898184e3Ssthen{ 69b8851fccSafresh1my $names = join "|", sort ascii_order values %$where2name; 70*3d61058aSafresh1is $names, "Blorm|squaa|zikzik"; 71898184e3Ssthen} 72898184e3Ssthen 73898184e3Ssthen{ 74b8851fccSafresh1my $names = join "|", sort ascii_order keys %$name2where; 75*3d61058aSafresh1is $names, "Blorm|squaa|zikzik"; 76898184e3Ssthen} 77898184e3Ssthen 78*3d61058aSafresh1like( ($name2where->{'squaa'} || 'huh???'), qr/squaa\.pm$/); 79898184e3Ssthen 80*3d61058aSafresh1is grep( m/squaa\.pm/, keys %$where2name ), 1; 81