summaryrefslogtreecommitdiff
path: root/cpan/Pod-Parser/t
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-01-22 20:07:04 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-01-22 21:44:09 +0000
commit462f46e7aee38f386b992c694ef8d1582002d30c (patch)
tree88c7134b3c209f5002178ed068eadc02e4c40dfd /cpan/Pod-Parser/t
parentc5cc8e289bbd2b9848866edb7f9aa5a8e6a1ae70 (diff)
downloadperl-462f46e7aee38f386b992c694ef8d1582002d30c.tar.gz
Update Pod-Parser to CPAN version 1.50
[DELTA] 16-Jan-2011 Marek Rouchal <marekr@cpan.org> ----------------------------------------------------------------------------- Version 1.50 + fix whitespace (esp. CR [\r] related) issues with different Perl versions on Windows (with Perl 5.8.8 [Activestate], and 5.6.1 [SUA]) + merge latest core (5.14.x) changes to this distro + CPAN#73446: fix minor POD error in InputObjects.pm + CPAN#43955: podchecker fails to detect superfluous =cut directive: implemented (and extended by a check for superfluous =pod commands) and documented in Pod::Checker; also added a note in the POD of all modules that they are part of the Pod::Parser distribution + CPAN#46695: use consistent version (1.50) for distribution and all Pod:: modules in this distro (except for Pod::PlainText, which stays at 2.05) + CPAN#52086: mismatch between distro and module version: same as above + CPAN#55121: correction for Pod::Find and t/pod/find.t on VMS + CPAN#47473: podchecker on L<> url with alt text ... causes an error in Pod::Checker now + CPAN#57954: Pod::Usage does not find perldoc when perl is relocatable ... use $Config{scriptdirexp} instead of scriptdir + CPAN#61223: podchecker notice missing blank line before command implemented with more tests in poderrs.t and self test of all *.pms + CPAN#66614: parse of no final newline vs perl -w ... a rare case, but fixed nevertheless + CPAN#68157: Pod-Parser-1.38/lib/Pod/Usage.pm question/bug ... pass through formatting options to Pod::Text + CPAN#70771: mishandles symbolic links in @INC ... fixed by making the paths in @INC absolute, using Cwd::abs_path() + CPAN#71139: 3 possible optimisations ... applied + several other rt.cpan.org tickets processed and closed
Diffstat (limited to 'cpan/Pod-Parser/t')
-rw-r--r--cpan/Pod-Parser/t/pod/empty.xr0
-rw-r--r--cpan/Pod-Parser/t/pod/find.t92
-rw-r--r--cpan/Pod-Parser/t/pod/poderrs.t32
-rw-r--r--cpan/Pod-Parser/t/pod/poderrs.xr35
-rw-r--r--cpan/Pod-Parser/t/pod/selfcheck.t45
-rw-r--r--cpan/Pod-Parser/t/pod/testpchk.pl3
6 files changed, 124 insertions, 83 deletions
diff --git a/cpan/Pod-Parser/t/pod/empty.xr b/cpan/Pod-Parser/t/pod/empty.xr
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cpan/Pod-Parser/t/pod/empty.xr
diff --git a/cpan/Pod-Parser/t/pod/find.t b/cpan/Pod-Parser/t/pod/find.t
index c4e8976721..27d48953dc 100644
--- a/cpan/Pod-Parser/t/pod/find.t
+++ b/cpan/Pod-Parser/t/pod/find.t
@@ -10,6 +10,7 @@ BEGIN {
}
}
+use strict;
use Test::More tests => 4;
BEGIN {
@@ -24,35 +25,15 @@ my $THISDIR = Cwd::cwd();
my $VERBOSE = $ENV{PERL_CORE} ? 0 : ($ENV{TEST_VERBOSE} || 0);
my $lib_dir = File::Spec->catdir($THISDIR,'lib');
-my $vms_unix_rpt = 0;
-my $vms_efs = 0;
-my $unix_mode = 1;
-
if ($^O eq 'VMS') {
- $lib_dir = VMS::Filespec::unixify(File::Spec->catdir($THISDIR,'-','lib','pod'));
- $Qlib_dir = $lib_dir;
- $Qlib_dir =~ s#\/#::#g;
-
- $unix_mode = 0;
- if (eval 'require VMS::Feature') {
- $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
- $vms_efs = VMS::Feature::current("efs_charset");
- } else {
- my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
- my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
- $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i;
- $vms_efs = $efs_charset =~ /^[ET1]/i;
- }
-
- # Traditional VMS mode only if VMS is not in UNIX compatible mode.
- $unix_mode = ($vms_efs && $vms_unix_rpt);
+ $lib_dir = VMS::Filespec::unixify($lib_dir);
}
print "### 2. searching $lib_dir\n";
my %pods = pod_find($lib_dir);
-my $result = join(',', sort values %pods);
-print "### found $result\n";
-my $compare = join(',', sort qw(
+my @results = values %pods;
+print "### found @results\n";
+my @compare = qw(
Pod::Checker
Pod::Find
Pod::InputObjects
@@ -61,28 +42,15 @@ my $compare = join(',', sort qw(
Pod::PlainText
Pod::Select
Pod::Usage
-));
-if ($^O eq 'VMS') {
- $compare = lc($compare);
- my $undollared = $Qlib_dir;
- $undollared =~ s/\$/\\\$/g;
- $undollared =~ s/\-/\\\-/g;
- $result =~ s/$undollared/pod::/g;
- $result =~ s/\$//g;
- my $count = 0;
- my @result = split(/,/,$result);
- my @compare = split(/,/,$compare);
- foreach(@compare) {
- $count += grep {/$_/} @result;
- }
- is($count/($#result+1)-1,$#compare);
-}
-elsif (File::Spec->case_tolerant || $^O eq 'dos') {
- is(lc $result,lc $compare);
-}
-else {
- is($result,$compare);
+);
+if (File::Spec->case_tolerant || $^O eq 'dos') {
+ # must downcase before sorting
+ map {$_ = lc $_} @compare;
+ map {$_ = lc $_} @results;
}
+my $compare = join(',', sort @compare);
+my $result = join(',', sort @results);
+is($result, $compare);
print "### 3. searching for File::Find\n";
$result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
@@ -90,31 +58,19 @@ $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
print "### found $result\n";
require Config;
-if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
- if ($unix_mode) {
- $compare = "../lib/File/Find.pm";
- } else {
- $compare = "lib.File]Find.pm";
- }
- $result =~ s/perl_root:\[\-?\.?//i;
- $result =~ s/\[\-?\.?//i; # needed under `mms test`
- is($result,$compare);
-}
-else {
- $compare = $ENV{PERL_CORE} ?
+$compare = $ENV{PERL_CORE} ?
File::Spec->catfile(File::Spec->updir, File::Spec->updir, 'lib','File','Find.pm')
: File::Spec->catfile($Config::Config{privlibexp},"File","Find.pm");
- 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");
- }
+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
diff --git a/cpan/Pod-Parser/t/pod/poderrs.t b/cpan/Pod-Parser/t/pod/poderrs.t
index 98c6320792..664e670aa8 100644
--- a/cpan/Pod-Parser/t/pod/poderrs.t
+++ b/cpan/Pod-Parser/t/pod/poderrs.t
@@ -118,6 +118,8 @@ L< aha>
L<oho >
L<"Warnings"> this one is ok
L</unescaped> ok too, this POD has an X of the same name
+L<http://www.perl.org> this is OK
+L<The Perl Home Page|http://www.perl.org> this is not OK
=head2 Warnings
@@ -192,6 +194,15 @@ we already have a head Misc
=head2 another one
+=head2 the next line should be empty
+=head2 ... but there is a command instead
+
+And here is some text
+=head2 again followed by a command
+
+ verbatim
+=item line missing
+
previous section is empty!
=head1 LINK TESTS
@@ -206,4 +217,25 @@ trigger a podchecker warning (using bleadperl) :
=cut
+=pod
+
+=head1 ON-OFF tests
+
+The above =pod is OK. The following =cut is ok, the one after not.
+
+=cut
+
+# some comment or code here, not POD
+
+=cut
+
+# more code
+
+=head2 This opens POD
+
+=pod
+
+And the =pod above is too much.
+
+=cut
diff --git a/cpan/Pod-Parser/t/pod/poderrs.xr b/cpan/Pod-Parser/t/pod/poderrs.xr
index 5b40d7a138..8534d9e177 100644
--- a/cpan/Pod-Parser/t/pod/poderrs.xr
+++ b/cpan/Pod-Parser/t/pod/poderrs.xr
@@ -27,21 +27,28 @@
*** ERROR: malformed link L<> : empty link at line 116 in file t/pod/poderrs.t
*** WARNING: ignoring leading whitespace in link at line 117 in file t/pod/poderrs.t
*** WARNING: ignoring trailing whitespace in link at line 118 in file t/pod/poderrs.t
-*** WARNING: (section) in 'passwd(5)' deprecated at line 124 in file t/pod/poderrs.t
-*** WARNING: node '$|' contains non-escaped | or / at line 125 in file t/pod/poderrs.t
-*** WARNING: alternative text '$|' contains non-escaped | or / at line 125 in file t/pod/poderrs.t
-*** ERROR: Spurious character(s) after =back at line 131 in file t/pod/poderrs.t
-*** ERROR: Nonempty Z<> at line 145 in file t/pod/poderrs.t
-*** ERROR: Empty X<> at line 147 in file t/pod/poderrs.t
-*** WARNING: preceding non-item paragraph(s) at line 153 in file t/pod/poderrs.t
-*** WARNING: No argument for =item at line 155 in file t/pod/poderrs.t
-*** WARNING: previous =item has no contents at line 157 in file t/pod/poderrs.t
-*** WARNING: No items in =over (at line 165) / =back list at line 167 in file t/pod/poderrs.t
-*** ERROR: Spurious text after =pod at line 173 in file t/pod/poderrs.t
-*** ERROR: Spurious text after =cut at line 177 in file t/pod/poderrs.t
-*** WARNING: empty section in previous paragraph at line 193 in file t/pod/poderrs.t
+*** WARNING: (section) in 'passwd(5)' deprecated at line 126 in file t/pod/poderrs.t
+*** WARNING: node '$|' contains non-escaped | or / at line 127 in file t/pod/poderrs.t
+*** WARNING: alternative text '$|' contains non-escaped | or / at line 127 in file t/pod/poderrs.t
+*** ERROR: Spurious character(s) after =back at line 133 in file t/pod/poderrs.t
+*** ERROR: Nonempty Z<> at line 147 in file t/pod/poderrs.t
+*** ERROR: Empty X<> at line 149 in file t/pod/poderrs.t
+*** WARNING: preceding non-item paragraph(s) at line 155 in file t/pod/poderrs.t
+*** WARNING: No argument for =item at line 157 in file t/pod/poderrs.t
+*** WARNING: previous =item has no contents at line 159 in file t/pod/poderrs.t
+*** WARNING: No items in =over (at line 167) / =back list at line 169 in file t/pod/poderrs.t
+*** ERROR: Spurious text after =pod at line 175 in file t/pod/poderrs.t
+*** ERROR: Spurious text after =cut at line 179 in file t/pod/poderrs.t
+*** WARNING: empty section in previous paragraph at line 195 in file t/pod/poderrs.t
+*** ERROR: Apparent command =head2 not preceded by blank line at line 198 in file t/pod/poderrs.t
+*** WARNING: empty section in previous paragraph at line 197 in file t/pod/poderrs.t
+*** ERROR: Apparent command =head2 not preceded by blank line at line 201 in file t/pod/poderrs.t
+*** ERROR: Apparent command =item not preceded by blank line at line 204 in file t/pod/poderrs.t
+*** ERROR: Spurious =cut command at line 230 in file t/pod/poderrs.t
+*** ERROR: Spurious =pod command at line 236 in file t/pod/poderrs.t
*** ERROR: unresolved internal link 'begin or begin' at line 108 in file t/pod/poderrs.t
*** ERROR: unresolved internal link 'end with begin' at line 109 in file t/pod/poderrs.t
*** ERROR: unresolved internal link 'OoPs' at line 110 in file t/pod/poderrs.t
*** ERROR: unresolved internal link 'abc def' at line 114 in file t/pod/poderrs.t
-*** ERROR: unresolved internal link 'I/O Operators' at line 202 in file t/pod/poderrs.t
+*** ERROR: hyperlink to URL with alt text deprecated in perlpodspec at line 122 in file t/pod/poderrs.t
+*** ERROR: unresolved internal link 'I/O Operators' at line 213 in file t/pod/poderrs.t
diff --git a/cpan/Pod-Parser/t/pod/selfcheck.t b/cpan/Pod-Parser/t/pod/selfcheck.t
new file mode 100644
index 0000000000..d170570c6c
--- /dev/null
+++ b/cpan/Pod-Parser/t/pod/selfcheck.t
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+use File::Basename;
+use File::Spec;
+use strict;
+my $THISDIR;
+BEGIN {
+ $THISDIR = dirname $0;
+ unshift @INC, $THISDIR;
+ require "testpchk.pl";
+ import TestPodChecker qw(testpodcheck);
+}
+
+# test that our POD is correct!
+my $path = File::Spec->catfile($THISDIR,(File::Spec->updir()) x 2, 'lib', 'Pod', '*.pm');
+print "THISDIR=$THISDIR PATH=$path\n";
+my @pods = glob($path);
+print "PODS=@pods\n";
+
+print "1..",scalar(@pods),"\n";
+
+my $errs = 0;
+my $testnum = 1;
+foreach my $pod (@pods) {
+ my $out = File::Spec->catfile($THISDIR, basename($pod));
+ $out =~ s{\.pm}{.OUT};
+ my %options = ( -Out => $out );
+ my $failmsg = testpodcheck(-In => $pod, -Out => $out, -Cmp => "$THISDIR/empty.xr");
+ if($failmsg) {
+ if(open(IN, "<$out")) {
+ while(<IN>) {
+ warn "podchecker: $_";
+ }
+ close(IN);
+ } else {
+ warn "Error: Cannot read output file $out: $!\n";
+ }
+ print "not ok $testnum\n";
+ $errs++;
+ } else {
+ print "ok $testnum\n";
+ }
+ $testnum++;
+}
+exit( ($errs == 0) ? 0 : -1 ) unless $ENV{HARNESS_ACTIVE};
+
diff --git a/cpan/Pod-Parser/t/pod/testpchk.pl b/cpan/Pod-Parser/t/pod/testpchk.pl
index 8aa10b94f8..aeb0be333d 100644
--- a/cpan/Pod-Parser/t/pod/testpchk.pl
+++ b/cpan/Pod-Parser/t/pod/testpchk.pl
@@ -23,6 +23,7 @@ use Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(&testpodchecker);
+@EXPORT_OK = qw(&testpodcheck);
$MYPKG = eval { (caller)[0] };
sub stripname( $ ) {
@@ -49,7 +50,7 @@ sub testpodcheck( @ ) {
my $cmpfile = $args{'-Cmp'} || croak "No compare-result file given!";
my $different = '';
- my $testname = basename $cmpfile, '.t', '.xr';
+ my $testname = basename $infile, '.t', '.xr';
unless (-e $cmpfile) {
my $msg = "*** Can't find comparison file $cmpfile for testing $infile";