summaryrefslogtreecommitdiff
path: root/t/pod
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2009-02-04 16:45:11 +0000
committerSteve Hay <SteveHay@planit.com>2009-02-04 17:38:36 +0000
commit8b2bdce690895574a192de0ae0dd992853e38c29 (patch)
tree598d14e5c6d46f13f024b49ace857ce7c1be8662 /t/pod
parentf44bdceebeee2f09fe107f15d8b99b0280171932 (diff)
downloadperl-8b2bdce690895574a192de0ae0dd992853e38c29.tar.gz
Upgrade to Pod-Parser-1.37.
Two local changes remain: part of the change to t/pod/pod2usage2.t in http://perl5.git.perl.org/perl.git/commitdiff/767c16a part of the change to lib/Pod/t/contains_pod.t in http://perl5.git.perl.org/perl.git/commitdiff/fb59f97
Diffstat (limited to 't/pod')
-rw-r--r--t/pod/find.t39
-rw-r--r--t/pod/pod2usage2.t2
-rw-r--r--t/pod/usage2.pod112
3 files changed, 80 insertions, 73 deletions
diff --git a/t/pod/find.t b/t/pod/find.t
index 6582dbbdff..bfd66cdb97 100644
--- a/t/pod/find.t
+++ b/t/pod/find.t
@@ -14,19 +14,15 @@ BEGIN {
$| = 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);
@@ -60,7 +56,7 @@ if ($^O eq 'VMS') {
$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";
@@ -91,16 +87,16 @@ if ($^O eq 'VMS') {
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";
@@ -114,18 +110,28 @@ if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
}
$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') ],
@@ -136,7 +142,8 @@ print "### found $result\n";
$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
diff --git a/t/pod/pod2usage2.t b/t/pod/pod2usage2.t
index 4cd75de14c..bb06ed54f9 100644
--- a/t/pod/pod2usage2.t
+++ b/t/pod/pod2usage2.t
@@ -164,7 +164,7 @@ if ($ENV{PERL_CORE}) {
$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";
diff --git a/t/pod/usage2.pod b/t/pod/usage2.pod
index 1e03b7dfc6..5c4817b8b1 100644
--- a/t/pod/usage2.pod
+++ b/t/pod/usage2.pod
@@ -1,56 +1,56 @@
-=head1 Heading-1
-
-=over 100
-
-=item One
-
-=item Two
-
-=back
-
-=head2 Heading 2
-
-Some text
-
-=head1 BugHeader
-
-Some text
-
-=head2 BugHeader2
-
-=over 4
-
-=item More
-
-=item Still More
-
-=back
-
-=head1 Heading-2
-
-=head2 Heading-2.2
-
-More text.
-
-=head1 OPTIONS AND ARGUMENTS
-
-=head2 Arguments
-
-The required arguments (which typically follow any options on the
-command line) are:
-
-=over
-
-=item I<destination>
-
-=item I<files>
-
-=back
-
-=head2 Options
-
-Options may be abbreviated. Options which take values may be separated
-from the values by whitespace or the "=" character.
-
-=cut
-
+=head1 Heading-1
+
+=over 100
+
+=item One
+
+=item Two
+
+=back
+
+=head2 Heading 2
+
+Some text
+
+=head1 BugHeader
+
+Some text
+
+=head2 BugHeader2
+
+=over 4
+
+=item More
+
+=item Still More
+
+=back
+
+=head1 Heading-2
+
+=head2 Heading-2.2
+
+More text.
+
+=head1 OPTIONS AND ARGUMENTS
+
+=head2 Arguments
+
+The required arguments (which typically follow any options on the
+command line) are:
+
+=over
+
+=item I<destination>
+
+=item I<files>
+
+=back
+
+=head2 Options
+
+Options may be abbreviated. Options which take values may be separated
+from the values by whitespace or the "=" character.
+
+=cut
+