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 => 4 } 12 13print "# ", __FILE__, 14 ": Testing forced case sensitivity ...\n"; 15 16my $x = Pod::Simple::Search->new; 17die "Couldn't make an object!?" unless ok defined $x; 18 19$x->inc(0); 20$x->is_case_insensitive(0); 21 22use File::Spec; 23use Cwd; 24my $cwd = cwd(); 25print "# CWD: $cwd\n"; 26 27sub source_path { 28 my $file = shift; 29 if ($ENV{PERL_CORE}) { 30 my $updir = File::Spec->updir; 31 my $dir = File::Spec->catdir($updir, 'lib', 'Pod', 'Simple', 't'); 32 return File::Spec->catdir ($dir, $file); 33 } else { 34 return $file; 35 } 36} 37 38my($A, $B); 39 40if( -e ($A = source_path( 'search60/A' ))) { 41 die "But where's $B?" 42 unless -e ($B = source_path( 'search60/B')); 43} elsif( -e ($A = File::Spec->catdir($cwd, 't', 'search60', 'A' ))) { 44 die "But where's $B?" 45 unless -e ($B = File::Spec->catdir($cwd, 't', 'search60', 'B')); 46} else { 47 die "Can't find the test corpora"; 48} 49print "# OK, found the test corpora\n# as $A\n# and $B\n#\n"; 50ok 1; 51 52my($name2where, $where2name) = $x->survey($A, $B); 53 54ok ($name2where->{x} =~ m{^\Q$A\E[\\/]x\.pod$}); 55 56ok ($name2where->{X} =~ m{^\Q$B\E[\\/]X\.pod$}); 57