# by Pod::Usage.
@ISA = qw(Pod::Select);
-$VERSION = '2.03';
+$VERSION = '2.04';
BEGIN {
if ($] < 5.006) {
if ($$self{alt}) {
$self->output ("\n== $_ ==\n\n");
} else {
+ $_ .= "\n" if $$self{loose};
$self->output (' ' x ($$self{indent} / 2) . $_ . "\n");
}
}
if ($$self{alt}) {
$self->output ("\n= $_ =\n");
} else {
+ $_ .= "\n" if $$self{loose};
$self->output (' ' x ($$self{indent}) . $_ . "\n");
}
}
=item loose
-If set to a true value, a blank line is printed after a C<=head1> heading.
-If set to false (the default), no blank line is printed after C<=head1>,
-although one is still printed after C<=head2>. This is the default because
-it's the expected formatting for manual pages; if you're formatting
-arbitrary text documents, setting this to true may result in more pleasing
-output.
+If set to a true value, a blank line is printed after a C<=headN> headings.
+If set to false (the default), no blank line is printed after C<=headN>.
+This is the default because it's the expected formatting for manual pages;
+if you're formatting arbitrary text documents, setting this to true may
+result in more pleasing output.
=item sentence
$| = 1;
-use Test;
+use Test::More tests => 4;
BEGIN {
- plan tests => 4;
- use File::Spec;
+ # 1. load successful
+ use_ok('Pod::Find', qw(pod_find pod_where));
}
-use Pod::Find qw(pod_find pod_where);
use File::Spec;
-# load successful
-ok(1);
-
require Cwd;
my $THISDIR = Cwd::cwd();
my $VERBOSE = $ENV{PERL_CORE} ? 0 : ($ENV{TEST_VERBOSE} || 0);
$unix_mode = ($vms_efs && $vms_unix_rpt);
}
-print "### searching $lib_dir\n";
+print "### 2. searching $lib_dir\n";
my %pods = pod_find($lib_dir);
my $result = join(',', sort values %pods);
print "### found $result\n";
foreach(@compare) {
$count += grep {/$_/} @result;
}
- ok($count/($#result+1)-1,$#compare);
+ is($count/($#result+1)-1,$#compare);
}
elsif (File::Spec->case_tolerant || $^O eq 'dos') {
- ok(lc $result,lc $compare);
+ is(lc $result,lc $compare);
}
else {
- ok($result,$compare);
+ is($result,$compare);
}
-print "### searching for File::Find\n";
+print "### 3. searching for File::Find\n";
$result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
|| 'undef - pod not found!';
print "### found $result\n";
}
$result =~ s/perl_root:\[\-?\.?//i;
$result =~ s/\[\-?\.?//i; # needed under `mms test`
- ok($result,$compare);
+ is($result,$compare);
}
else {
$compare = $ENV{PERL_CORE} ?
File::Spec->catfile(File::Spec->updir, 'lib','File','Find.pm')
: File::Spec->catfile($Config::Config{privlibexp},"File","Find.pm");
- ok(_canon($result),_canon($compare));
+ my $resfile = _canon($result);
+ my $cmpfile = _canon($compare);
+ if($^O =~ /dos|win32/i && $resfile =~ /~\d(?=\\|$)/) {
+ # we have ~1 short filenames
+ $resfile = quotemeta($resfile);
+ $resfile =~ s/\\~\d(?=\\|$)/[^\\\\]+/g;
+ ok($cmpfile =~ /^$resfile$/, "pod_where found File::Find (with long filename matching)") ||
+ diag("'$cmpfile' does not match /^$resfile\$/");
+ } else {
+ is($resfile,$cmpfile,"pod_where found File::Find");
+ }
}
# Search for a documentation pod rather than a module
my $searchpod = 'Stuff';
-print "### searching for $searchpod.pod\n";
+print "### 4. searching for $searchpod.pod\n";
$result = pod_where(
{ -dirs => [ File::Spec->catdir(
$ENV{PERL_CORE} ? () : qw(t), 'pod', 'testpods', 'lib', 'Pod') ],
$compare = File::Spec->catfile(
$ENV{PERL_CORE} ? () : qw(t),
'pod', 'testpods', 'lib', 'Pod' ,'Stuff.pm');
-ok(_canon($result),_canon($compare));
+is(_canon($result),_canon($compare));
+
# make the path as generic as possible
sub _canon
$pod_file2 = File::Spec->catfile(qw(t pod usage2.pod));
}
-($exit, $text) = getoutput( sub { system($^X, $blib, $test_script); exit($? >> 8); } );
+($exit, $text) = getoutput( sub { system($^X, $blib, $test_script); exit($? >> 8); } );
$text =~ s{#Using.*/blib.*\n}{}; # older blib's emit something to STDERR
is ($exit, 17, "Exit status pod2usage (-verbose => 2, -input => \*DATA)");
ok (compare ($text, <<'EOT'), "Output test pod2usage (-verbose => 2, -input => \*DATA)") or diag "Got:\n$text\n";