summaryrefslogtreecommitdiff
path: root/lib/Pod/t
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2008-07-22 08:21:12 +0000
committerSteve Hay <SteveHay@planit.com>2008-07-22 08:21:12 +0000
commit0e4e3f6e96b9ad39aace3852993d3e7cb5e33891 (patch)
tree89320fb1ec80a1696ed3d2bce21def1550fd7584 /lib/Pod/t
parent7bb7fa3865f82f68e5e39dfa527ac1bbbafc8dcf (diff)
downloadperl-0e4e3f6e96b9ad39aace3852993d3e7cb5e33891.tar.gz
Upgrade to podlators 2.1.2
p4raw-id: //depot/perl@34153
Diffstat (limited to 'lib/Pod/t')
-rw-r--r--lib/Pod/t/basic.man4
-rw-r--r--lib/Pod/t/man-options.t43
-rw-r--r--lib/Pod/t/man.t2
-rw-r--r--lib/Pod/t/pod-spelling.t63
-rw-r--r--lib/Pod/t/pod.t11
-rw-r--r--lib/Pod/t/text.t2
6 files changed, 120 insertions, 5 deletions
diff --git a/lib/Pod/t/basic.man b/lib/Pod/t/basic.man
index 9c2248e935..43874b6e87 100644
--- a/lib/Pod/t/basic.man
+++ b/lib/Pod/t/basic.man
@@ -7,7 +7,7 @@ other interesting bits.
.ie n .SH "This ""is"" a ""level 1"" heading"
.el .SH "This \f(CWis\fP a ``level 1'' heading"
.IX Header "This is a level 1 heading"
-.Sh "``Level'' ""2 \fIheading\fP"
+.SS "``Level'' ""2 \fIheading\fP"
.IX Subsection "``Level'' ""2 heading"
\fILevel 3 \f(BIheading \f(BIwith \f(CB\*(C`weird \f(CBstuff "" (double quote)\f(CB\*(C'\f(BI\f(BI\fI\fR
.IX Subsection "Level 3 heading with weird stuff """" (double quote)"
@@ -20,7 +20,7 @@ Now try again with \fBintermixed\fR \fItext\fR.
.el .SH "This \f(CWis\fP a ``level 1'' heading"
.IX Header "This is a level 1 heading"
Text.
-.Sh "``Level'' 2 \fIheading\fP"
+.SS "``Level'' 2 \fIheading\fP"
.IX Subsection "``Level'' 2 heading"
Text.
.PP
diff --git a/lib/Pod/t/man-options.t b/lib/Pod/t/man-options.t
index 928d7542fa..f00e7d1aba 100644
--- a/lib/Pod/t/man-options.t
+++ b/lib/Pod/t/man-options.t
@@ -16,7 +16,7 @@ BEGIN {
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..2\n";
+ print "1..7\n";
}
END {
@@ -47,8 +47,12 @@ while (<DATA>) {
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
$parser->parse_from_file ('tmp.pod', \*OUT);
close OUT;
+ my $accents = 0;
open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
- while (<TMP>) { last if /^\.nh/ }
+ while (<TMP>) {
+ $accents = 1 if /Accent mark definitions/;
+ last if /^\.nh/;
+ }
my $output;
{
local $/;
@@ -56,6 +60,14 @@ while (<DATA>) {
}
close TMP;
unlink ('tmp.pod', 'out.tmp');
+ if (($options{utf8} && !$accents) || (!$options{utf8} && $accents)) {
+ print "ok $n\n";
+ } else {
+ print "not ok $n\n";
+ print ($accents ? "Saw accents\n" : "Saw no accents\n");
+ print ($options{utf8} ? "Wanted no accents\n" : "Wanted accents\n");
+ }
+ $n++;
my $expected = '';
while (<DATA>) {
last if $_ eq "###\n";
@@ -101,3 +113,30 @@ Beyoncé! Beyoncé! Beyoncé!!
.PP
Older versions did not convert Beyoncé in verbatim.
###
+
+###
+utf8 1
+###
+=head1 SE<lt>E<gt> output with UTF-8
+
+This is S<non-breaking output>.
+###
+.SH "S<> output with UTF\-8"
+.IX Header "S<> output with UTF-8"
+This is non\-breaking output.
+###
+
+###
+fixed CR
+fixedbold CY
+fixeditalic CW
+fixedbolditalic CX
+###
+=head1 FIXED FONTS
+
+C<foo B<bar I<baz>> I<bay>>
+###
+.SH "FIXED FONTS"
+.IX Header "FIXED FONTS"
+\&\f(CR\*(C`foo \f(CYbar \f(CXbaz\f(CY\f(CR \f(CWbay\f(CR\*(C'\fR
+###
diff --git a/lib/Pod/t/man.t b/lib/Pod/t/man.t
index 6b162177a5..7071ba8f83 100644
--- a/lib/Pod/t/man.t
+++ b/lib/Pod/t/man.t
@@ -347,7 +347,7 @@ Oboy, is this C++ "fun" yet! (guesswork)
###
.SH "NAME"
"Stuff" (no guesswork)
-.Sh "\s-1THINGS\s0"
+.SS "\s-1THINGS\s0"
.IX Subsection "THINGS"
Oboy, is this \*(C+ \*(L"fun\*(R" yet! (guesswork)
###
diff --git a/lib/Pod/t/pod-spelling.t b/lib/Pod/t/pod-spelling.t
new file mode 100644
index 0000000000..3ac4f758b6
--- /dev/null
+++ b/lib/Pod/t/pod-spelling.t
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+#
+# t/pod-spelling.t -- Test POD spelling.
+
+# Called to skip all tests with a reason.
+sub skip_all {
+ print "1..1\n";
+ print "ok 1 # skip - @_\n";
+ exit;
+}
+
+# Make sure we have prerequisites. hunspell is currently not supported due to
+# lack of support for contractions.
+eval 'use Test::Pod 1.00';
+skip_all "Test::Pod 1.00 required for testing POD" if $@;
+eval 'use Pod::Spell';
+skip_all "Pod::Spell required to test POD spelling" if $@;
+my @spell;
+for my $dir (split ':', $ENV{PATH}) {
+ if (-x "$dir/ispell") {
+ @spell = ("$dir/ispell", '-d', 'american', '-l');
+ }
+ last if @spell;
+}
+skip_all "ispell required to test POD spelling" unless @spell;
+
+# Run the test, one for each POD file.
+$| = 1;
+my @pod = all_pod_files ();
+my $count = scalar @pod;
+print "1..$count\n";
+my $n = 1;
+for my $pod (@pod) {
+ my $child = open (CHILD, '-|');
+ if (not defined $child) {
+ die "Cannot fork: $!\n";
+ } elsif ($child == 0) {
+ my $pid = open (SPELL, '|-', @spell) or die "Cannot run @spell: $!\n";
+ open (POD, '<', $pod) or die "Cannot open $pod: $!\n";
+ my $parser = Pod::Spell->new;
+ $parser->parse_from_filehandle (\*POD, \*SPELL);
+ close POD;
+ close SPELL;
+ exit ($? >> 8);
+ } else {
+ my @words = <CHILD>;
+ close CHILD;
+ if ($? != 0) {
+ print "ok $n # skip - @spell failed\n";
+ } elsif (@words) {
+ for (@words) {
+ s/^\s+//;
+ s/\s+$//;
+ }
+ print "not ok $n\n";
+ print " - Misspelled words found in $pod\n";
+ print " @words\n";
+ } else {
+ print "ok $n\n";
+ }
+ $n++;
+ }
+}
diff --git a/lib/Pod/t/pod.t b/lib/Pod/t/pod.t
new file mode 100644
index 0000000000..ecb37a642c
--- /dev/null
+++ b/lib/Pod/t/pod.t
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+#
+# t/pod.t -- Test POD formatting.
+
+eval 'use Test::Pod 1.00';
+if ($@) {
+ print "1..1\n";
+ print "ok 1 # skip - Test::Pod 1.00 required for testing POD\n";
+ exit;
+}
+all_pod_files_ok ();
diff --git a/lib/Pod/t/text.t b/lib/Pod/t/text.t
index 05d445a150..185e94434a 100644
--- a/lib/Pod/t/text.t
+++ b/lib/Pod/t/text.t
@@ -57,6 +57,8 @@ while (<DATA>) {
}
if ($output eq $expected) {
print "ok $n\n";
+ } elsif ($n == 4 && $Pod::Simple::VERSION < 3.06) {
+ print "ok $n # skip Pod::Simple S<> parsing bug\n";
} else {
print "not ok $n\n";
print "Expected\n========\n$expected\nOutput\n======\n$output\n";