summaryrefslogtreecommitdiff
path: root/lib/Pod/t
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2008-11-07 08:47:26 +0000
committerSteve Hay <SteveHay@planit.com>2008-11-07 08:47:26 +0000
commit9f2f055aa1e8c86d97b5ea42473ab1747f518f3a (patch)
treee1212dc0d5e0cc17adc3b16631339cef8cf4e63a /lib/Pod/t
parent3327bb648bca3705820d35dd728f98436ea9f8aa (diff)
downloadperl-9f2f055aa1e8c86d97b5ea42473ab1747f518f3a.tar.gz
Upgrade to podlators-2.2.0
p4raw-id: //depot/perl@34758
Diffstat (limited to 'lib/Pod/t')
-rw-r--r--lib/Pod/t/man-utf8.t2
-rw-r--r--lib/Pod/t/pod-spelling.t12
-rw-r--r--lib/Pod/t/text-encoding.t141
-rw-r--r--lib/Pod/t/text-options.t2
-rwxr-xr-xlib/Pod/t/text-utf8.t2
5 files changed, 153 insertions, 6 deletions
diff --git a/lib/Pod/t/man-utf8.t b/lib/Pod/t/man-utf8.t
index a53208baad..8b44d6b290 100644
--- a/lib/Pod/t/man-utf8.t
+++ b/lib/Pod/t/man-utf8.t
@@ -39,6 +39,7 @@ print "ok 1\n";
my $n = 2;
eval { binmode (\*DATA, ':encoding(utf-8)') };
+eval { binmode (\*STDOUT, ':encoding(utf-8)') };
while (<DATA>) {
my %options;
next until $_ eq "###\n";
@@ -57,7 +58,6 @@ while (<DATA>) {
close TMP;
my $parser = Pod::Man->new (%options) or die "Cannot create parser\n";
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
- eval { binmode (\*OUT, ':encoding(utf-8)') };
$parser->parse_from_file ('tmp.pod', \*OUT);
close OUT;
my $accents = 0;
diff --git a/lib/Pod/t/pod-spelling.t b/lib/Pod/t/pod-spelling.t
index c13fb9d587..41c902782e 100644
--- a/lib/Pod/t/pod-spelling.t
+++ b/lib/Pod/t/pod-spelling.t
@@ -1,14 +1,22 @@
#!/usr/bin/perl
#
# t/pod-spelling.t -- Test POD spelling.
+#
+# Copyright 2008 Russ Allbery <rra@stanford.edu>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
# Called to skip all tests with a reason.
sub skip_all {
- print "1..1\n";
- print "ok 1 # skip - @_\n";
+ print "1..0 # Skipped: @_\n";
exit;
}
+# Skip all spelling tests unless flagged to run maintainer tests.
+skip_all "Spelling tests only run for maintainer"
+ unless $ENV{RRA_MAINTAINER_TESTS};
+
# Make sure we have prerequisites. hunspell is currently not supported due to
# lack of support for contractions.
eval 'use Test::Pod 1.00';
diff --git a/lib/Pod/t/text-encoding.t b/lib/Pod/t/text-encoding.t
new file mode 100644
index 0000000000..2d624808bf
--- /dev/null
+++ b/lib/Pod/t/text-encoding.t
@@ -0,0 +1,141 @@
+#!/usr/bin/perl -w
+#
+# text-encoding.t -- Test Pod::Text with various weird encoding combinations.
+#
+# Copyright 2002, 2004, 2006, 2007, 2008 by Russ Allbery <rra@stanford.edu>
+#
+# This program is free software; you may redistribute it and/or modify it
+# under the same terms as Perl itself.
+
+BEGIN {
+ chdir 't' if -d 't';
+ if ($ENV{PERL_CORE}) {
+ @INC = '../lib';
+ } else {
+ unshift (@INC, '../blib/lib');
+ }
+ unshift (@INC, '../blib/lib');
+ $| = 1;
+ print "1..4\n";
+
+ # PerlIO encoding support requires Perl 5.8 or later.
+ if ($] < 5.008) {
+ my $n;
+ for $n (1..4) {
+ print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n";
+ }
+ exit;
+ }
+}
+
+END {
+ print "not ok 1\n" unless $loaded;
+}
+
+use Pod::Text;
+
+$loaded = 1;
+print "ok 1\n";
+
+my $n = 2;
+eval { binmode (\*DATA, ':raw') };
+eval { binmode (\*STDOUT, ':raw') };
+while (<DATA>) {
+ my %opts;
+ $opts{utf8} = 1 if $n == 4;
+ my $parser = Pod::Text->new (%opts) or die "Cannot create parser\n";
+ next until $_ eq "###\n";
+ open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
+ eval { binmode (\*TMP, ':raw') };
+ while (<DATA>) {
+ last if $_ eq "###\n";
+ print TMP $_;
+ }
+ close TMP;
+ open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
+ $parser->parse_from_file ('tmp.pod', \*OUT);
+ close OUT;
+ open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
+ eval { binmode (\*TMP, ':raw') };
+ my $output;
+ {
+ local $/;
+ $output = <TMP>;
+ }
+ close TMP;
+ unlink ('tmp.pod', 'out.tmp');
+ my $expected = '';
+ while (<DATA>) {
+ last if $_ eq "###\n";
+ $expected .= $_;
+ }
+ if ($output eq $expected) {
+ print "ok $n\n";
+ } else {
+ print "not ok $n\n";
+ print "Expected\n========\n$expected\nOutput\n======\n$output\n";
+ }
+ $n++;
+}
+
+# Below the marker are bits of POD and corresponding expected text output.
+# This is used to test specific features or problems with Pod::Text. The
+# input and output are separated by lines containing only ###.
+
+__DATA__
+
+###
+=head1 Test of SE<lt>E<gt>
+
+This is S<some whitespace>.
+###
+Test of S<>
+ This is some whitespace.
+
+###
+
+###
+=encoding utf-8
+
+=head1 I can eat glass
+
+=over 4
+
+=item Esperanto
+
+Mi povas manĝi vitron, ĝi ne damaĝas min.
+
+=item Braille
+
+⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑
+
+=item Hindi
+
+मैं काँच खा सकता हूँ और मुझे उससे कोई चोट नहीं पहुंचती.
+
+=back
+
+See L<http://www.columbia.edu/kermit/utf8.html>
+###
+I can eat glass
+ Esperanto
+ Mi povas manĝi vitron, ĝi ne damaĝas min.
+
+ Braille
+ ⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞â
+ €â ™â •â ‘⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑
+
+ Hindi
+ मैं काँच खा सकता हूँ और
+ मुझे उससे कोई चोट नहीं
+ पहुंचती.
+
+ See <http://www.columbia.edu/kermit/utf8.html>
+
+###
+
+###
+=head1 Beyoncé
+###
+Beyoncé
+###
diff --git a/lib/Pod/t/text-options.t b/lib/Pod/t/text-options.t
index 24843e4502..e2146c26f4 100644
--- a/lib/Pod/t/text-options.t
+++ b/lib/Pod/t/text-options.t
@@ -2,7 +2,7 @@
#
# text-options.t -- Additional tests for Pod::Text options.
#
-# Copyright 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2008 by Russ Allbery <rra@stanford.edu>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
diff --git a/lib/Pod/t/text-utf8.t b/lib/Pod/t/text-utf8.t
index 3d2904a426..806947827e 100755
--- a/lib/Pod/t/text-utf8.t
+++ b/lib/Pod/t/text-utf8.t
@@ -33,7 +33,6 @@ END {
}
use Pod::Text;
-use Pod::Simple;
$loaded = 1;
print "ok 1\n";
@@ -53,7 +52,6 @@ while (<DATA>) {
}
close TMP;
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
- eval { binmode (\*OUT, ':encoding(utf-8)') };
$parser->parse_from_file ('tmp.pod', \*OUT);
close OUT;
open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";