summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST3
-rwxr-xr-xPorting/Maintainers.pl2
-rw-r--r--cpan/podlators/VERSION2
-rw-r--r--cpan/podlators/lib/Pod/Man.pm37
-rw-r--r--cpan/podlators/lib/Pod/ParseLink.pm28
-rw-r--r--cpan/podlators/lib/Pod/Text.pm29
-rw-r--r--cpan/podlators/lib/Pod/Text/Color.pm13
-rw-r--r--cpan/podlators/lib/Pod/Text/Overstrike.pm26
-rw-r--r--cpan/podlators/lib/Pod/Text/Termcap.pm15
-rw-r--r--cpan/podlators/t/basic.t125
-rw-r--r--cpan/podlators/t/color.t79
-rwxr-xr-xcpan/podlators/t/devise-date.t15
-rw-r--r--cpan/podlators/t/filehandle.t47
-rwxr-xr-xcpan/podlators/t/man-heading.t90
-rw-r--r--cpan/podlators/t/man-options.t46
-rw-r--r--cpan/podlators/t/man-utf8.t60
-rw-r--r--cpan/podlators/t/man.t72
-rwxr-xr-xcpan/podlators/t/overstrike.t103
-rw-r--r--cpan/podlators/t/parselink.t50
-rw-r--r--cpan/podlators/t/pod-parser.t52
-rw-r--r--cpan/podlators/t/pod-spelling.t59
-rw-r--r--cpan/podlators/t/pod.t17
-rw-r--r--cpan/podlators/t/termcap.t65
-rw-r--r--cpan/podlators/t/text-encoding.t52
-rw-r--r--cpan/podlators/t/text-options.t40
-rw-r--r--cpan/podlators/t/text-utf8.t49
-rw-r--r--cpan/podlators/t/text.t39
-rwxr-xr-x[-rw-r--r--]pod/pod2man.PL3
-rwxr-xr-x[-rw-r--r--]pod/pod2text.PL0
29 files changed, 727 insertions, 491 deletions
diff --git a/MANIFEST b/MANIFEST
index 8dd829e30e..17056fc740 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1765,10 +1765,13 @@ cpan/podlators/t/basic.pod podlators test
cpan/podlators/t/basic.t podlators test
cpan/podlators/t/basic.txt podlators test
cpan/podlators/t/color.t podlators test
+cpan/podlators/t/devise-date.t podlators test
cpan/podlators/t/filehandle.t podlators test
+cpan/podlators/t/man-heading.t podlators test
cpan/podlators/t/man-options.t podlators test
cpan/podlators/t/man.t podlators test
cpan/podlators/t/man-utf8.t podlators test
+cpan/podlators/t/overstrike.t podlators test
cpan/podlators/t/parselink.t podlators test
cpan/podlators/t/pod-parser.t podlators test
cpan/podlators/t/pod-spelling.t podlators test
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 68aadfadd7..8198cabd34 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1308,7 +1308,7 @@ use File::Glob qw(:case);
'podlators' =>
{
'MAINTAINER' => 'rra',
- 'DISTRIBUTION' => 'RRA/podlators-2.2.2.tar.gz',
+ 'DISTRIBUTION' => 'RRA/podlators-2.3.0.tar.gz',
'FILES' => q[cpan/podlators
pod/pod2man.PL
pod/pod2text.PL
diff --git a/cpan/podlators/VERSION b/cpan/podlators/VERSION
index 279daa436b..753d9924e5 100644
--- a/cpan/podlators/VERSION
+++ b/cpan/podlators/VERSION
@@ -1 +1 @@
-$VERSION = '2.2.2';
+$VERSION = '2.3.0';
diff --git a/cpan/podlators/lib/Pod/Man.pm b/cpan/podlators/lib/Pod/Man.pm
index 71a4d7a7f5..9339f835bb 100644
--- a/cpan/podlators/lib/Pod/Man.pm
+++ b/cpan/podlators/lib/Pod/Man.pm
@@ -32,11 +32,10 @@ use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION);
use Carp qw(croak);
use Pod::Simple ();
-use POSIX qw(strftime);
@ISA = qw(Pod::Simple);
-$VERSION = '2.22';
+$VERSION = '2.23';
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
@@ -255,11 +254,11 @@ sub _handle_element_start {
# If we have a command handler, we need to accumulate the contents of the
# tag before calling it. Turn off IN_NAME for any command other than
- # <Para> so that IN_NAME isn't still set for the first heading after the
- # NAME heading.
+ # <Para> and the formatting codes so that IN_NAME isn't still set for the
+ # first heading after the NAME heading.
if ($self->can ("cmd_$method")) {
DEBUG > 2 and print "<$element> starts saving a tag\n";
- $$self{IN_NAME} = 0 if ($element ne 'Para');
+ $$self{IN_NAME} = 0 if ($element ne 'Para' && length ($element) > 1);
# How we're going to format embedded text blocks depends on the tag
# and also depends on our parent tags. Thankfully, inside tags that
@@ -396,6 +395,10 @@ sub quote_literal {
# several places in the following regex.
my $index = '(?: \[.*\] | \{.*\} )?';
+ # If in NAME section, just return an ASCII quoted string to avoid
+ # confusing tools like whatis.
+ return qq{"$_"} if $$self{IN_NAME};
+
# Check for things that we don't want to quote, and if we find any of
# them, return the string with just a font change and no quoting.
m{
@@ -712,6 +715,7 @@ sub outindex {
for (@output) {
my ($type, $entry) = @$_;
$entry =~ s/\"/\"\"/g;
+ $entry =~ s/\\/\\\\/g;
$self->output (".IX $type " . '"' . $entry . '"' . "\n");
}
}
@@ -853,7 +857,12 @@ sub devise_date {
} else {
$time = time;
}
- return strftime ('%Y-%m-%d', localtime $time);
+
+ # Can't use POSIX::strftime(), which uses Fcntl, because MakeMaker
+ # uses this and it has to work in the core which can't load dynamic
+ # libraries.
+ my ($year, $month, $day) = (localtime $time)[5,4,3];
+ return sprintf ("%04d-%02d-%02d", $year + 1900, $month + 1, $day);
}
# Print out the preamble and the title. The meaning of the arguments to .TH
@@ -1076,9 +1085,9 @@ sub cmd_head4 {
# All of the formatting codes that aren't handled internally by the parser,
# other than L<> and X<>.
-sub cmd_b { return '\f(BS' . $_[2] . '\f(BE' }
-sub cmd_i { return '\f(IS' . $_[2] . '\f(IE' }
-sub cmd_f { return '\f(IS' . $_[2] . '\f(IE' }
+sub cmd_b { return $_[0]->{IN_NAME} ? $_[2] : '\f(BS' . $_[2] . '\f(BE' }
+sub cmd_i { return $_[0]->{IN_NAME} ? $_[2] : '\f(IS' . $_[2] . '\f(IE' }
+sub cmd_f { return $_[0]->{IN_NAME} ? $_[2] : '\f(IS' . $_[2] . '\f(IE' }
sub cmd_c { return $_[0]->quote_literal ($_[2]) }
# Index entries are just added to the pending entries.
@@ -1092,7 +1101,15 @@ sub cmd_x {
# a URL.
sub cmd_l {
my ($self, $attrs, $text) = @_;
- return $$attrs{type} eq 'url' ? "<$text>" : $text;
+ if ($$attrs{type} eq 'url') {
+ if (not defined($$attrs{to}) or $$attrs{to} eq $text) {
+ return "<$text>";
+ } else {
+ return "$text <$$attrs{to}>";
+ }
+ } else {
+ return $text;
+ }
}
##############################################################################
diff --git a/cpan/podlators/lib/Pod/ParseLink.pm b/cpan/podlators/lib/Pod/ParseLink.pm
index 7cb2d656f6..750fdfb88d 100644
--- a/cpan/podlators/lib/Pod/ParseLink.pm
+++ b/cpan/podlators/lib/Pod/ParseLink.pm
@@ -1,6 +1,6 @@
# Pod::ParseLink -- Parse an L<> formatting code in POD text.
#
-# Copyright 2001, 2008 by Russ Allbery <rra@stanford.edu>
+# Copyright 2001, 2008, 2009 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.
@@ -30,7 +30,7 @@ use Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(parselink);
-$VERSION = '1.09';
+$VERSION = '1.10';
##############################################################################
# Implementation
@@ -81,15 +81,25 @@ sub _infer_text {
sub parselink {
my ($link) = @_;
$link =~ s/\s+/ /g;
+ my $text;
+ if ($link =~ /\|/) {
+ ($text, $link) = split (/\|/, $link, 2);
+ }
if ($link =~ /\A\w+:[^:\s]\S*\Z/) {
- return (undef, $link, $link, undef, 'url');
- } else {
- my $text;
- if ($link =~ /\|/) {
- ($text, $link) = split (/\|/, $link, 2);
+ my $inferred;
+ if (defined ($text) && length ($text) > 0) {
+ return ($text, $text, $link, undef, 'url');
+ } else {
+ return ($text, $link, $link, undef, 'url');
}
+ } else {
my ($name, $section) = _parse_section ($link);
- my $inferred = $text || _infer_text ($name, $section);
+ my $inferred;
+ if (defined ($text) && length ($text) > 0) {
+ $inferred = $text;
+ } else {
+ $inferred = _infer_text ($name, $section);
+ }
my $type = ($name && $name =~ /\(\S*\)/) ? 'man' : 'pod';
return ($text, $inferred, $name, $section, $type);
}
@@ -174,7 +184,7 @@ Russ Allbery <rra@stanford.edu>.
=head1 COPYRIGHT AND LICENSE
-Copyright 2001, 2008 Russ Allbery <rra@stanford.edu>.
+Copyright 2001, 2008, 2009 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/cpan/podlators/lib/Pod/Text.pm b/cpan/podlators/lib/Pod/Text.pm
index 533c4cf4fe..c68313c389 100644
--- a/cpan/podlators/lib/Pod/Text.pm
+++ b/cpan/podlators/lib/Pod/Text.pm
@@ -1,6 +1,6 @@
# Pod::Text -- Convert POD data to formatted ASCII text.
#
-# Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008
+# Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009
# Russ Allbery <rra@stanford.edu>
#
# This program is free software; you may redistribute it and/or modify it
@@ -37,7 +37,7 @@ use Pod::Simple ();
# We have to export pod2text for backward compatibility.
@EXPORT = qw(pod2text);
-$VERSION = '3.13';
+$VERSION = '3.14';
##############################################################################
# Initialization
@@ -304,6 +304,14 @@ sub start_document {
# Text blocks
##############################################################################
+# Intended for subclasses to override, this method returns text with any
+# non-printing formatting codes stripped out so that length() correctly
+# returns the length of the text. For basic Pod::Text, it does nothing.
+sub strip_format {
+ my ($self, $string) = @_;
+ return $string;
+}
+
# This method is called whenever an =item command is complete (in other words,
# we've seen its associated paragraph or know for certain that it doesn't have
# one). It gets the paragraph associated with the item as an argument. If
@@ -325,7 +333,8 @@ sub item {
my $indent = $$self{INDENTS}[-1];
$indent = $$self{opt_indent} unless defined $indent;
my $margin = ' ' x $$self{opt_margin};
- my $fits = ($$self{MARGIN} - $indent >= length ($tag) + 1);
+ my $tag_length = length ($self->strip_format ($tag));
+ my $fits = ($$self{MARGIN} - $indent >= $tag_length + 1);
# If the tag doesn't fit, or if we have no associated text, print out the
# tag separately. Otherwise, put the tag in the margin of the paragraph.
@@ -350,7 +359,7 @@ sub item {
$space =~ s/^$margin /$margin:/ if $$self{opt_alt};
$text = $self->reformat ($text);
$text =~ s/^$margin /$margin:/ if ($$self{opt_alt} && $indent > 0);
- my $tagspace = ' ' x length $tag;
+ my $tagspace = ' ' x $tag_length;
$text =~ s/^($space)$tagspace/$1$tag/ or warn "Bizarre space in item";
$self->output ($text);
}
@@ -563,7 +572,15 @@ sub cmd_c {
# a URL.
sub cmd_l {
my ($self, $attrs, $text) = @_;
- return $$attrs{type} eq 'url' ? "<$text>" : $text;
+ if ($$attrs{type} eq 'url') {
+ if (not defined($$attrs{to}) or $$attrs{to} eq $text) {
+ return "<$text>";
+ } else {
+ return "$text <$$attrs{to}>";
+ }
+ } else {
+ return $text;
+ }
}
##############################################################################
@@ -852,7 +869,7 @@ how to use Pod::Simple.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008 Russ Allbery
+Copyright 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009 Russ Allbery
<rra@stanford.edu>.
This program is free software; you may redistribute it and/or modify it
diff --git a/cpan/podlators/lib/Pod/Text/Color.pm b/cpan/podlators/lib/Pod/Text/Color.pm
index 517f5d0458..1c81a7b4c8 100644
--- a/cpan/podlators/lib/Pod/Text/Color.pm
+++ b/cpan/podlators/lib/Pod/Text/Color.pm
@@ -1,6 +1,6 @@
# Pod::Text::Color -- Convert POD data to formatted color ASCII text
#
-# Copyright 1999, 2001, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu>
+# Copyright 1999, 2001, 2004, 2006, 2008, 2009 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.
@@ -57,6 +57,15 @@ sub output_code {
$self->output ($code);
}
+# Strip all of the formatting from a provided string, returning the stripped
+# version. We will eventually want to use colorstrip() from Term::ANSIColor,
+# but it's fairly new so avoid the tight dependency.
+sub strip_format {
+ my ($self, $text) = @_;
+ $text =~ s/\e\[[\d;]*m//g;
+ return $text;
+}
+
# We unfortunately have to override the wrapping code here, since the normal
# wrapping code gets really confused by all the escape sequences.
sub wrap {
@@ -138,7 +147,7 @@ Russ Allbery <rra@stanford.edu>.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2001, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu>.
+Copyright 1999, 2001, 2004, 2006, 2008, 2009 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/cpan/podlators/lib/Pod/Text/Overstrike.pm b/cpan/podlators/lib/Pod/Text/Overstrike.pm
index a76fc28f8e..7578f0f8f5 100644
--- a/cpan/podlators/lib/Pod/Text/Overstrike.pm
+++ b/cpan/podlators/lib/Pod/Text/Overstrike.pm
@@ -34,7 +34,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '2.03';
+$VERSION = '2.04';
##############################################################################
# Overrides
@@ -99,6 +99,15 @@ sub output_code {
$self->output ($code);
}
+# Strip all of the formatting from a provided string, returning the stripped
+# version.
+sub strip_format {
+ my ($self, $text) = @_;
+ $text =~ s/(.)[\b]\1/$1/g;
+ $text =~ s/_[\b]//g;
+ return $text;
+}
+
# We unfortunately have to override the wrapping code here, since the normal
# wrapping code gets really confused by all the backspaces.
sub wrap {
@@ -125,19 +134,6 @@ sub wrap {
}
##############################################################################
-# Utility functions
-##############################################################################
-
-# Strip all of the formatting from a provided string, returning the stripped
-# version.
-sub strip_format {
- my ($self, $text) = @_;
- $text =~ s/(.)[\b]\1/$1/g;
- $text =~ s/_[\b]//g;
- return $text;
-}
-
-##############################################################################
# Module return value and documentation
##############################################################################
@@ -204,7 +200,7 @@ Joe Smith <Joe.Smith@inwap.com>, using the framework created by Russ Allbery
=head1 COPYRIGHT AND LICENSE
Copyright 2000 by Joe Smith <Joe.Smith@inwap.com>.
-Copyright 2001, 2004 by Russ Allbery <rra@stanford.edu>.
+Copyright 2001, 2004, 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/cpan/podlators/lib/Pod/Text/Termcap.pm b/cpan/podlators/lib/Pod/Text/Termcap.pm
index 4a75b30251..708f1e8081 100644
--- a/cpan/podlators/lib/Pod/Text/Termcap.pm
+++ b/cpan/podlators/lib/Pod/Text/Termcap.pm
@@ -1,6 +1,7 @@
# Pod::Text::Termcap -- Convert POD data to ASCII text with format escapes.
#
-# Copyright 1999, 2001, 2002, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu>
+# Copyright 1999, 2001, 2002, 2004, 2006, 2008, 2009
+# 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.
@@ -93,6 +94,16 @@ sub output_code {
$self->output ($$self{BOLD} . $code . $$self{NORM});
}
+# Strip all of the formatting from a provided string, returning the stripped
+# version.
+sub strip_format {
+ my ($self, $text) = @_;
+ $text =~ s/\Q$$self{BOLD}//g;
+ $text =~ s/\Q$$self{UNDL}//g;
+ $text =~ s/\Q$$self{NORM}//g;
+ return $text;
+}
+
# Override the wrapping code to igore the special sequences.
sub wrap {
my $self = shift;
@@ -175,7 +186,7 @@ Russ Allbery <rra@stanford.edu>.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2001, 2002, 2004, 2006, 2008 Russ Allbery
+Copyright 1999, 2001, 2002, 2004, 2006, 2008, 2009 Russ Allbery
<rra@stanford.edu>.
This program is free software; you may redistribute it and/or modify it
diff --git a/cpan/podlators/t/basic.t b/cpan/podlators/t/basic.t
index 603d108574..eb94ef22a3 100644
--- a/cpan/podlators/t/basic.t
+++ b/cpan/podlators/t/basic.t
@@ -2,7 +2,7 @@
#
# basic.t -- Basic tests for podlators.
#
-# Copyright 2001, 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2001, 2002, 2004, 2006, 2009 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.
@@ -11,22 +11,21 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..11\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Man;
-use Pod::Text;
-use Pod::Text::Overstrike;
-use Pod::Text::Termcap;
+use Test::More tests => 15;
+
+BEGIN {
+ use_ok ('Pod::Man');
+ use_ok ('Pod::Text');
+ use_ok ('Pod::Text::Overstrike');
+ use_ok ('Pod::Text::Termcap');
+}
# Find the path to the test source files. This requires some fiddling when
# these tests are run as part of Perl core.
@@ -42,9 +41,6 @@ sub source_path {
}
}
-$loaded = 1;
-print "ok 1\n";
-
# Hard-code a few values to try to get reproducible results.
$ENV{COLUMNS} = 80;
$ENV{TERM} = 'xterm';
@@ -59,69 +55,62 @@ my %translators = ('Pod::Man' => 'man',
'Pod::Text::Termcap' => 'cap');
# Set default options to match those of pod2man and pod2text.
-%options = (sentence => 0);
+our %options = (sentence => 0);
-my $n = 2;
-for (sort keys %translators) {
- if ($_ eq 'Pod::Text::Color') {
- eval { require Term::ANSIColor };
- if ($@) {
- print "ok $n # skip\n";
- $n++;
- print "ok $n # skip\n";
- $n++;
- next;
+for my $module (sort keys %translators) {
+ SKIP: {
+ if ($module eq 'Pod::Text::Color') {
+ eval { require Term::ANSIColor };
+ skip 'Term::ANSIColor not found', 3 if $@;
+ require_ok ('Pod::Text::Color');
}
- require Pod::Text::Color;
- }
- my $parser = $_->new (%options);
- print (($parser && ref ($parser) eq $_) ? "ok $n\n" : "not ok $n\n");
- $n++;
+ my $parser = $module->new (%options);
+ isa_ok ($parser, $module, 'Parser object');
- # For Pod::Man, strip out the autogenerated header up to the .TH title
- # line. That means that we don't check those things; oh well. The header
- # changes with each version change or touch of the input file.
- open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
- $parser->parse_from_file (source_path ('basic.pod'), \*OUT);
- close OUT;
- if ($_ eq 'Pod::Man') {
- open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
- open (OUTPUT, "> out.$translators{$_}")
- or die "Cannot create out.$translators{$_}: $!\n";
- local $_;
- while (<TMP>) { last if /^\.nh/ }
- print OUTPUT while <TMP>;
- close OUTPUT;
- close TMP;
- unlink 'out.tmp';
- } else {
- rename ('out.tmp', "out.$translators{$_}")
- or die "Cannot rename out.tmp: $!\n";
- }
- {
- local $/;
- open (MASTER, source_path ("basic.$translators{$_}"))
- or die "Cannot open basic.$translators{$_}: $!\n";
- open (OUTPUT, "out.$translators{$_}")
- or die "Cannot open out.$translators{$_}: $!\n";
- my $master = <MASTER>;
- my $output = <OUTPUT>;
- close MASTER;
- close OUTPUT;
+ # For Pod::Man, strip out the autogenerated header up to the .TH title
+ # line. That means that we don't check those things; oh well. The
+ # header changes with each version change or touch of the input file.
+ open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
+ $parser->parse_from_file (source_path ('basic.pod'), \*OUT);
+ close OUT;
+ if ($module eq 'Pod::Man') {
+ open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
+ open (OUTPUT, "> out.$translators{$module}")
+ or die "Cannot create out.$translators{$module}: $!\n";
+ local $_;
+ while (<TMP>) { last if /^\.nh/ }
+ print OUTPUT while <TMP>;
+ close OUTPUT;
+ close TMP;
+ 1 while unlink 'out.tmp';
+ } else {
+ rename ('out.tmp', "out.$translators{$module}")
+ or die "Cannot rename out.tmp: $!\n";
+ }
+
+ # Slurp the output and expected output and compare them.
+ my ($master, $output);
+ {
+ local $/;
+ open (MASTER, source_path ("basic.$translators{$module}"))
+ or die "Cannot open basic.$translators{$module}: $!\n";
+ open (OUTPUT, "out.$translators{$module}")
+ or die "Cannot open out.$translators{$module}: $!\n";
+ $master = <MASTER>;
+ $output = <OUTPUT>;
+ close MASTER;
+ close OUTPUT;
+ }
# OS/390 is EBCDIC, which uses a different character for ESC
# apparently. Try to convert so that the test still works.
- if ($^O eq 'os390' && $_ eq 'Pod::Text::Termcap') {
+ if ($^O eq 'os390' and $module eq 'Pod::Text::Termcap') {
$output =~ tr/\033/\047/;
}
-
- if ($master eq $output) {
- print "ok $n\n";
- unlink "out.$translators{$_}";
+ if (ok ($master eq $output, "$module output is correct")) {
+ 1 while unlink "out.$translators{$module}";
} else {
- print "not ok $n\n";
- print "# Non-matching output left in out.$translators{$_}\n";
+ diag ("Non-matching output left in out.$translators{$module}\n");
}
}
- $n++;
}
diff --git a/cpan/podlators/t/color.t b/cpan/podlators/t/color.t
index 2f1668f88e..f6be17b7cd 100644
--- a/cpan/podlators/t/color.t
+++ b/cpan/podlators/t/color.t
@@ -2,7 +2,7 @@
#
# color.t -- Additional specialized tests for Pod::Text::Color.
#
-# Copyright 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2009 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.
@@ -11,33 +11,29 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..2\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
+
+use Test::More;
+# Skip this test if Term::ANSIColor isn't available.
eval { require Term::ANSIColor };
if ($@) {
- for (1..2) {
- print "ok $_ # skip\n";
- }
- $loaded = 1;
- exit;
+ plan skip_all => 'Term::ANSIColor required for Pod::Text::Color';
+} else {
+ plan tests => 4;
}
-require Pod::Text::Color;
+require_ok ('Pod::Text::Color');
-$loaded = 1;
-print "ok 1\n";
-
-my $parser = Pod::Text::Color->new or die "Cannot create parser\n";
-my $n = 2;
+# Load tests from the data section below, write the POD to a temporary file,
+# convert it, and compare to the expected output.
+my $parser = Pod::Text::Color->new;
+isa_ok ($parser, 'Pod::Text::Color', 'Parser object');
+my $n = 1;
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -56,24 +52,19 @@ while (<DATA>) {
$output = <TMP>;
}
close TMP;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while 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";
- }
+ is ($output, $expected, "Output correct for test $n");
$n++;
}
# Below the marker are bits of POD and corresponding expected output. This is
-# used to test specific features or problems with Pod::Text::Termcap. The
-# input and output are separated by lines containing only ###.
+# used to test specific features or problems with Pod::Text::Color. The input
+# and output are separated by lines containing only ###.
__DATA__
@@ -86,3 +77,37 @@ B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>.
Do not include formatting codes when wrapping.
###
+
+###
+=head1 TAG WIDTH
+
+=over 10
+
+=item 12345678
+
+A
+
+=item B<12345678>
+
+B
+
+=item 1
+
+C
+
+=item B<1>
+
+D
+
+=back
+###
+TAG WIDTH
+ 12345678 A
+
+ 12345678 B
+
+ 1 C
+
+ 1 D
+
+###
diff --git a/cpan/podlators/t/devise-date.t b/cpan/podlators/t/devise-date.t
new file mode 100755
index 0000000000..3cce9f5b01
--- /dev/null
+++ b/cpan/podlators/t/devise-date.t
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+
+# In order for MakeMaker to build in the core, nothing can use
+# Fcntl which includes POSIX. devise_date()'s use of strftime()
+# was replaced. This tests that it's identical.
+
+use strict;
+
+use Test::More tests => 1;
+
+use Pod::Man;
+use POSIX qw(strftime);
+
+my $parser = Pod::Man->new;
+is $parser->devise_date, strftime("%Y-%m-%d", localtime);
diff --git a/cpan/podlators/t/filehandle.t b/cpan/podlators/t/filehandle.t
index a53884d50d..1ed0667b33 100644
--- a/cpan/podlators/t/filehandle.t
+++ b/cpan/podlators/t/filehandle.t
@@ -2,7 +2,7 @@
#
# filehandle.t -- Test the parse_from_filehandle interface.
#
-# Copyright 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2006, 2009 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.
@@ -11,27 +11,24 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..3\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Man;
-use Pod::Text;
+use Test::More tests => 6;
-$loaded = 1;
-print "ok 1\n";
+BEGIN {
+ use_ok ('Pod::Man');
+ use_ok ('Pod::Text');
+}
-my $man = Pod::Man->new or die "Cannot create parser\n";
-my $text = Pod::Text->new or die "Cannot create parser\n";
-my $n = 2;
+my $man = Pod::Man->new;
+isa_ok ($man, 'Pod::Man', 'Pod::Man parser object');
+my $text = Pod::Text->new;
+isa_ok ($text, 'Pod::Text', 'Pod::Text parser object');
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -40,6 +37,8 @@ while (<DATA>) {
print TMP $_;
}
close TMP;
+
+ # Test Pod::Man output.
open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
$man->parse_from_filehandle (\*IN, \*OUT);
@@ -58,13 +57,9 @@ 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++;
+ is ($output, $expected, 'Pod::Man output is correct');
+
+ # Test Pod::Text output.
open (IN, '< tmp.pod') or die "Cannot open tmp.pod: $!\n";
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
$text->parse_from_filehandle (\*IN, \*OUT);
@@ -76,19 +71,13 @@ while (<DATA>) {
$output = <OUT>;
}
close OUT;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while unlink ('tmp.pod', 'out.tmp');
$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++;
+ is ($output, $expected, 'Pod::Text output is correct');
}
# Below the marker are bits of POD, corresponding expected nroff output, and
diff --git a/cpan/podlators/t/man-heading.t b/cpan/podlators/t/man-heading.t
new file mode 100755
index 0000000000..f7e470e3c0
--- /dev/null
+++ b/cpan/podlators/t/man-heading.t
@@ -0,0 +1,90 @@
+#!/usr/bin/perl -w
+#
+# man-options.t -- Additional tests for Pod::Man options.
+#
+# Copyright 2002, 2004, 2006, 2008, 2009 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';
+ }
+ unshift (@INC, '../blib/lib');
+ $| = 1;
+}
+
+use strict;
+
+use Test::More tests => 7;
+BEGIN { use_ok ('Pod::Man') }
+
+my $n = 1;
+while (<DATA>) {
+ my %options;
+ next until $_ eq "###\n";
+ while (<DATA>) {
+ last if $_ eq "###\n";
+ my ($option, $value) = split (' ', $_, 2);
+ chomp $value;
+ $options{$option} = $value;
+ }
+ open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
+ print TMP "=head1 NAME\n\ntest - Test man page\n";
+ close TMP;
+ my $parser = Pod::Man->new (%options);
+ isa_ok ($parser, 'Pod::Man', 'Parser object');
+ 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";
+ my $heading;
+ while (<TMP>) {
+ if (/^\.TH/) {
+ $heading = $_;
+ last;
+ }
+ }
+ close TMP;
+ unlink ('tmp.pod', 'out.tmp');
+ my $expected = '';
+ while (<DATA>) {
+ last if $_ eq "###\n";
+ $expected .= $_;
+ }
+ is ($heading, $expected, "Heading is correct for test $n");
+ $n++;
+}
+
+# Below the marker are sets of options and the corresponding expected .TH line
+# from the man page. This is used to test specific features or problems with
+# Pod::Man. The options and output are separated by lines containing only
+# ###.
+
+__DATA__
+
+###
+date 2009-01-17
+release 1.0
+###
+.TH TMP 1 "2009-01-17" "1.0" "User Contributed Perl Documentation"
+###
+
+###
+date 2009-01-17
+name TEST
+section 8
+release 2.0-beta
+###
+.TH TEST 8 "2009-01-17" "2.0-beta" "User Contributed Perl Documentation"
+###
+
+###
+date 2009-01-17
+release 1.0
+center Testing Documentation
+###
+.TH TMP 1 "2009-01-17" "1.0" "Testing Documentation"
+###
diff --git a/cpan/podlators/t/man-options.t b/cpan/podlators/t/man-options.t
index 04895d539c..0cc09fae2b 100644
--- a/cpan/podlators/t/man-options.t
+++ b/cpan/podlators/t/man-options.t
@@ -2,7 +2,7 @@
#
# man-options.t -- Additional tests for Pod::Man options.
#
-# Copyright 2002, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2008, 2009 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.
@@ -11,19 +11,15 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..7\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Man;
+use Test::More tests => 10;
+BEGIN { use_ok ('Pod::Man') }
# Redirect stderr to a file.
sub stderr_save {
@@ -38,10 +34,7 @@ sub stderr_restore {
close OLDERR;
}
-$loaded = 1;
-print "ok 1\n";
-
-my $n = 2;
+my $n = 1;
while (<DATA>) {
my %options;
next until $_ eq "###\n";
@@ -56,7 +49,8 @@ while (<DATA>) {
print TMP $_;
}
close TMP;
- my $parser = Pod::Man->new (%options) or die "Cannot create parser\n";
+ my $parser = Pod::Man->new (%options);
+ isa_ok ($parser, 'Pod::Man', 'Parser object');
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
stderr_save;
$parser->parse_from_file ('tmp.pod', \*OUT);
@@ -73,19 +67,13 @@ while (<DATA>) {
$output = <TMP>;
}
close TMP;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while 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++;
+ is ($output, $expected, "Output correct for test $n");
open (ERR, 'out.err') or die "Cannot open out.err: $!\n";
my $errors;
{
@@ -93,24 +81,20 @@ while (<DATA>) {
$errors = <ERR>;
}
close ERR;
- unlink ('out.err');
+ 1 while unlink ('out.err');
$expected = '';
while (<DATA>) {
last if $_ eq "###\n";
$expected .= $_;
}
- if ($errors eq $expected) {
- print "ok $n\n";
- } else {
- print "not ok $n\n";
- print "Expected errors:\n ${expected}Errors:\n $errors";
- }
+ is ($errors, $expected, "Errors are correct for test $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::Man. The
-# input and output are separated by lines containing only ###.
+# Below the marker are bits of POD and corresponding expected text output and
+# error output. This is used to test specific features or problems with
+# Pod::Man. The options, input, output, and errors are separated by lines
+# containing only ###.
__DATA__
diff --git a/cpan/podlators/t/man-utf8.t b/cpan/podlators/t/man-utf8.t
index 8b44d6b290..05a1505e20 100644
--- a/cpan/podlators/t/man-utf8.t
+++ b/cpan/podlators/t/man-utf8.t
@@ -2,7 +2,7 @@
#
# man-options.t -- Additional tests for Pod::Man options.
#
-# Copyright 2002, 2004, 2006, 2008 Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2008, 2009 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.
@@ -11,35 +11,34 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..5\n";
-
- # UTF-8 support requires Perl 5.8 or later.
- if ($] < 5.008) {
- my $n;
- for $n (1..5) {
- print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n";
- }
- exit;
- }
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Man;
+use Test::More;
-$loaded = 1;
-print "ok 1\n";
+# UTF-8 support requires Perl 5.8 or later.
+BEGIN {
+ if ($] < 5.008) {
+ plan skip_all => 'Perl 5.8 required for UTF-8 support';
+ } else {
+ plan tests => 7;
+ }
+}
+BEGIN { use_ok ('Pod::Man') }
-my $n = 2;
+# Force UTF-8 on all relevant file handles. Do this inside eval in case the
+# encoding parameter doesn't work.
eval { binmode (\*DATA, ':encoding(utf-8)') };
eval { binmode (\*STDOUT, ':encoding(utf-8)') };
+my $builder = Test::More->builder;
+eval { binmode ($builder->output, ':encoding(utf-8)') };
+eval { binmode ($builder->failure_output, ':encoding(utf-8)') };
+
+my $n = 1;
while (<DATA>) {
my %options;
next until $_ eq "###\n";
@@ -56,7 +55,8 @@ while (<DATA>) {
print TMP $_;
}
close TMP;
- my $parser = Pod::Man->new (%options) or die "Cannot create parser\n";
+ my $parser = Pod::Man->new (%options);
+ isa_ok ($parser, 'Pod::Man', 'Parser object');
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
$parser->parse_from_file ('tmp.pod', \*OUT);
close OUT;
@@ -73,26 +73,18 @@ while (<DATA>) {
$output = <TMP>;
}
close TMP;
- unlink ('tmp.pod', 'out.tmp');
- if (($options{utf8} && !$accents) || (!$options{utf8} && $accents)) {
- print "ok $n\n";
+ 1 while unlink ('tmp.pod', 'out.tmp');
+ if ($options{utf8}) {
+ ok (!$accents, "Saw no accent definitions for test $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");
+ ok ($accents, "Saw accent definitions for test $n");
}
- $n++;
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";
- }
+ is ($output, $expected, "Output correct for test $n");
$n++;
}
diff --git a/cpan/podlators/t/man.t b/cpan/podlators/t/man.t
index 419cce3ee6..ea5a636ab5 100644
--- a/cpan/podlators/t/man.t
+++ b/cpan/podlators/t/man.t
@@ -2,7 +2,7 @@
#
# man.t -- Additional specialized tests for Pod::Man.
#
-# Copyright 2002, 2003, 2004, 2006, 2007, 2008
+# Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009
# Russ Allbery <rra@stanford.edu>
#
# This program is free software; you may redistribute it and/or modify it
@@ -12,28 +12,22 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..25\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
-
-use Pod::Man;
+use strict;
-$loaded = 1;
-print "ok 1\n";
+use Test::More tests => 30;
+BEGIN { use_ok ('Pod::Man') }
# Test whether we can use binmode to set encoding.
my $have_encoding = (eval { require PerlIO::encoding; 1 } and not $@);
-my $parser = Pod::Man->new or die "Cannot create parser\n";
-my $n = 2;
+my $parser = Pod::Man->new;
+isa_ok ($parser, 'Pod::Man', 'Parser object');
+my $n = 1;
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -59,18 +53,13 @@ while (<DATA>) {
$output = <OUT>;
}
close OUT;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while 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";
- }
+ is ($output, $expected, "Output correct for test $n");
$n++;
}
@@ -83,14 +72,14 @@ __DATA__
###
=head1 NAME
-gcc - GNU project C and C++ compiler
+gcc - GNU project C<C> and C++ compiler
=head1 C++ NOTES
Other mentions of C++.
###
.SH "NAME"
-gcc \- GNU project C and C++ compiler
+gcc \- GNU project "C" and C++ compiler
.SH "\*(C+ NOTES"
.IX Header " NOTES"
Other mentions of \*(C+.
@@ -482,3 +471,42 @@ Some raw nroff.
.PP
More text.
###
+
+###
+=head1 NAME
+
+test - C<test>
+###
+.SH "NAME"
+test \- "test"
+###
+
+###
+=head1 INDEX
+
+Index entry matching a whitespace escape.X<\n>
+###
+.SH "INDEX"
+.IX Header "INDEX"
+Index entry matching a whitespace escape.
+.IX Xref "\\n"
+###
+
+###
+=head1 LINK TO URL
+
+This is a L<link|http://www.example.com/> to a URL.
+###
+.SH "LINK TO URL"
+.IX Header "LINK TO URL"
+This is a link <http://www.example.com/> to a \s-1URL\s0.
+###
+
+###
+=head1 NAME
+
+test - B<test> I<italics> F<file>
+###
+.SH "NAME"
+test \- test italics file
+###
diff --git a/cpan/podlators/t/overstrike.t b/cpan/podlators/t/overstrike.t
new file mode 100755
index 0000000000..bbfa0db9fb
--- /dev/null
+++ b/cpan/podlators/t/overstrike.t
@@ -0,0 +1,103 @@
+#!/usr/bin/perl -w
+#
+# overstrike.t -- Additional specialized tests for Pod::Text::Overstrike.
+#
+# Copyright 2002, 2004, 2006, 2009 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';
+ }
+ unshift (@INC, '../blib/lib');
+ $| = 1;
+}
+
+use strict;
+
+use Test::More tests => 4;
+BEGIN { use_ok ('Pod::Text::Overstrike') }
+
+my $parser = Pod::Text::Overstrike->new;
+isa_ok ($parser, 'Pod::Text::Overstrike', 'Parser module');
+my $n = 1;
+while (<DATA>) {
+ next until $_ eq "###\n";
+ open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
+ 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";
+ my $output;
+ {
+ local $/;
+ $output = <TMP>;
+ }
+ close TMP;
+ 1 while unlink ('tmp.pod', 'out.tmp');
+ my $expected = '';
+ while (<DATA>) {
+ last if $_ eq "###\n";
+ $expected .= $_;
+ }
+ is ($output, $expected, "Output correct for test $n");
+ $n++;
+}
+
+# Below the marker are bits of POD and corresponding expected output. This is
+# used to test specific features or problems with Pod::Text::Termcap. The
+# input and output are separated by lines containing only ###.
+
+__DATA__
+
+###
+=head1 WRAPPING
+
+B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>.
+###
+WWRRAAPPPPIINNGG
+ DDoo _n_o_t iinncclluuddee ffoorrmmaattttiinngg  ccooddeess  wwhheenn wwrraappppiinngg.
+
+###
+
+###
+=head1 TAG WIDTH
+
+=over 10
+
+=item 12345678
+
+A
+
+=item B<12345678>
+
+B
+
+=item 1
+
+C
+
+=item B<1>
+
+D
+
+=back
+###
+TTAAGG  WWIIDDTTHH
+ 12345678 A
+
+ 1122334455667788 B
+
+ 1 C
+
+ 11 D
+
+###
diff --git a/cpan/podlators/t/parselink.t b/cpan/podlators/t/parselink.t
index c5c2bb660b..828b2ec8e1 100644
--- a/cpan/podlators/t/parselink.t
+++ b/cpan/podlators/t/parselink.t
@@ -2,17 +2,14 @@
#
# parselink.t -- Tests for Pod::ParseLink.
#
-# Copyright 2001 by Russ Allbery <rra@stanford.edu>
+# Copyright 2001, 2009 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.
# The format of each entry in this array is the L<> text followed by the
-# five-element parse returned by parselink. When adding a new test, also
-# increment the test count in the BEGIN block below. We don't use any of the
-# fancy test modules intentionally for backward compatibility to older
-# versions of Perl.
-@TESTS = (
+# five-element parse returned by parselink.
+our @TESTS = (
[ 'foo',
undef, 'foo', 'foo', undef, 'pod' ],
@@ -87,46 +84,37 @@
[ 'news:yld72axzc8.fsf@windlord.stanford.edu',
undef, 'news:yld72axzc8.fsf@windlord.stanford.edu',
- 'news:yld72axzc8.fsf@windlord.stanford.edu', undef, 'url' ]
+ 'news:yld72axzc8.fsf@windlord.stanford.edu', undef, 'url' ],
+
+ [ 'link|http://www.perl.org/',
+ 'link', 'link', 'http://www.perl.org/', undef, 'url' ],
+
+ [ '0|http://www.perl.org/',
+ '0', '0', 'http://www.perl.org/', undef, 'url' ],
+
+ [ '0|Pod::Parser',
+ '0', '0', 'Pod::Parser', undef, 'pod' ],
);
BEGIN {
chdir 't' if -d 't';
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..25\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::ParseLink;
-$loaded = 1;
-print "ok 1\n";
+use Test::More tests => 28;
+BEGIN { use_ok ('Pod::ParseLink') }
# Used for reporting test failures.
my @names = qw(text inferred name section type);
-my $n = 2;
for (@TESTS) {
my @expected = @$_;
my $link = shift @expected;
my @results = parselink ($link);
- my $okay = 1;
- for (0..4) {
- # Make sure to check undef explicitly; we don't want undef to match
- # the empty string because they're semantically different.
- unless ((!defined ($results[$_]) && !defined ($expected[$_]))
- || (defined ($results[$_]) && defined ($expected[$_])
- && $results[$_] eq $expected[$_])) {
- print "not ok $n\n" if $okay;
- print "# Incorrect $names[$_]:\n";
- print "# expected: $expected[$_]\n";
- print "# seen: $results[$_]\n";
- $okay = 0;
- }
- }
- print "ok $n\n" if $okay;
- $n++;
+ my $pretty = $link;
+ $pretty =~ s/\n/\\n/g;
+ is_deeply (\@results, \@expected, $pretty);
}
diff --git a/cpan/podlators/t/pod-parser.t b/cpan/podlators/t/pod-parser.t
index 318a76bc15..ae2ef01676 100644
--- a/cpan/podlators/t/pod-parser.t
+++ b/cpan/podlators/t/pod-parser.t
@@ -2,7 +2,7 @@
#
# pod-parser.t -- Tests for backward compatibility with Pod::Parser.
#
-# Copyright 2006, 2008 by Russ Allbery <rra@stanford.edu>
+# Copyright 2006, 2008, 2009 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.
@@ -11,28 +11,21 @@ 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";
}
-my $loaded;
-
-END {
- print "not ok 1\n" unless $loaded;
-}
-
-use Pod::Man;
-use Pod::Text;
use strict;
-$loaded = 1;
-print "ok 1\n";
+use Test::More tests => 7;
+BEGIN {
+ use_ok ('Pod::Man');
+ use_ok ('Pod::Text');
+}
-my $parser = Pod::Man->new or die "Cannot create parser\n";
+my $parser = Pod::Man->new;
+isa_ok ($parser, 'Pod::Man', 'Pod::Man parser object');
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
print TMP "Some random B<text>.\n";
close TMP;
@@ -47,15 +40,10 @@ my $output;
$output = <OUT>;
}
close OUT;
-if ($output eq "Some random \\fBtext\\fR.\n") {
- print "ok 2\n";
-} else {
- print "not ok 2\n";
- print "Expected\n========\nSome random \\fBtext\\fR.\n\n";
- print "Output\n======\n$output\n";
-}
+is ($output, "Some random \\fBtext\\fR.\n", 'Pod::Man -cutting output');
-$parser = Pod::Text->new or die "Cannot create parser\n";
+$parser = Pod::Text->new;
+isa_ok ($parser, 'Pod::Text', 'Pod::Text parser object');
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
$parser->parse_from_file ({ -cutting => 0 }, 'tmp.pod', \*OUT);
close OUT;
@@ -65,13 +53,7 @@ open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
$output = <OUT>;
}
close OUT;
-if ($output eq " Some random text.\n\n") {
- print "ok 3\n";
-} else {
- print "not ok 3\n";
- print "Expected\n========\n Some random text.\n\n\n";
- print "Output\n======\n$output\n";
-}
+is ($output, " Some random text.\n\n", 'Pod::Text -cutting output');
# Test the pod2text function, particularly with only one argument.
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -90,13 +72,7 @@ open (OUT, 'out.tmp') or die "Cannot open out.tmp: $!\n";
$output = <OUT>;
}
close OUT;
-if ($output eq " Some random text.\n\n") {
- print "ok 4\n";
-} else {
- print "not ok 4\n";
- print "Expected\n========\n Some random text.\n\n\n";
- print "Output\n======\n$output\n";
-}
+is ($output, " Some random text.\n\n", 'Pod::Text pod2text function');
-unlink ('tmp.pod', 'out.tmp');
+1 while unlink ('tmp.pod', 'out.tmp');
exit 0;
diff --git a/cpan/podlators/t/pod-spelling.t b/cpan/podlators/t/pod-spelling.t
index 41c902782e..d3ab858f9e 100644
--- a/cpan/podlators/t/pod-spelling.t
+++ b/cpan/podlators/t/pod-spelling.t
@@ -1,28 +1,32 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
#
-# t/pod-spelling.t -- Test POD spelling.
+# Check for spelling errors in POD documentation
#
-# Copyright 2008 Russ Allbery <rra@stanford.edu>
+# Checks all POD files in the tree for spelling problems using Pod::Spell and
+# either aspell or ispell. aspell is preferred. This test is disabled unless
+# RRA_MAINTAINER_TESTS is set, since spelling dictionaries vary too much
+# between environments.
+#
+# Copyright 2008, 2009 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..0 # Skipped: @_\n";
- exit;
-}
+use strict;
+use Test::More;
-# Skip all spelling tests unless flagged to run maintainer tests.
-skip_all "Spelling tests only run for maintainer"
+# Skip all spelling tests unless the maintainer environment variable is set.
+plan 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.
+# Load required Perl modules.
eval 'use Test::Pod 1.00';
-skip_all "Test::Pod 1.00 required for testing POD" if $@;
+plan 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 $@;
+plan skip_all => 'Pod::Spell required to test POD spelling' if $@;
+
+# Locate a spell-checker. hunspell is not currently supported due to its lack
+# of support for contractions (at least in the version in Debian).
my @spell;
my %options = (aspell => [ qw(-d en_US --home-dir=./ list) ],
ispell => [ qw(-d american -l -p /dev/null) ]);
@@ -34,21 +38,22 @@ SEARCH: for my $program (qw/aspell ispell/) {
last SEARCH if @spell;
}
}
-skip_all "aspell or ispell required to test POD spelling" unless @spell;
+plan skip_all => 'aspell or ispell required to test POD spelling'
+ unless @spell;
-# Run the test, one for each POD file.
+# Prerequisites are satisfied, so we're going to do some testing. Figure out
+# what POD files we have and from that develop our plan.
$| = 1;
my @pod = all_pod_files ();
-my $count = scalar @pod;
-print "1..$count\n";
-my $n = 1;
+plan tests => scalar @pod;
+
+# Finally, do the checks.
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";
+ 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);
@@ -58,19 +63,13 @@ for my $pod (@pod) {
} else {
my @words = <CHILD>;
close CHILD;
- if ($? != 0) {
- print "ok $n # skip - @spell failed: $?\n";
- } elsif (@words) {
+ SKIP: {
+ skip "@spell failed for $pod", 1 unless $? == 0;
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";
+ is ("@words", '', $pod);
}
- $n++;
}
}
diff --git a/cpan/podlators/t/pod.t b/cpan/podlators/t/pod.t
index ecb37a642c..e570e18bb4 100644
--- a/cpan/podlators/t/pod.t
+++ b/cpan/podlators/t/pod.t
@@ -1,11 +1,14 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
#
-# t/pod.t -- Test POD formatting.
+# Test POD formatting.
+#
+# Copyright 2009 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.
+use strict;
+use Test::More;
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;
-}
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok ();
diff --git a/cpan/podlators/t/termcap.t b/cpan/podlators/t/termcap.t
index 5ec98288f6..c75cb44bb4 100644
--- a/cpan/podlators/t/termcap.t
+++ b/cpan/podlators/t/termcap.t
@@ -2,7 +2,7 @@
#
# termcap.t -- Additional specialized tests for Pod::Text::Termcap.
#
-# Copyright 2002, 2004, 2006 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2009 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.
@@ -11,30 +11,24 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..2\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
+
+use Test::More tests => 4;
+BEGIN { use_ok ('Pod::Text::Termcap') }
# Hard-code a few values to try to get reproducible results.
$ENV{COLUMNS} = 80;
$ENV{TERM} = 'xterm';
$ENV{TERMCAP} = 'xterm:co=80:do=^J:md=\E[1m:us=\E[4m:me=\E[m';
-use Pod::Text::Termcap;
-
-$loaded = 1;
-print "ok 1\n";
-
-my $parser = Pod::Text::Termcap->new or die "Cannot create parser\n";
-my $n = 2;
+my $parser = Pod::Text::Termcap->new;
+isa_ok ($parser, 'Pod::Text::Termcap', 'Parser module');
+my $n = 1;
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -53,18 +47,13 @@ while (<DATA>) {
$output = <TMP>;
}
close TMP;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while 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";
- }
+ is ($output, $expected, "Output correct for test $n");
$n++;
}
@@ -83,3 +72,37 @@ B<I<Do>> I<B<not>> B<I<include>> B<I<formatting codes when>> B<I<wrapping>>.
Do not include formatting codes when wrapping.
###
+
+###
+=head1 TAG WIDTH
+
+=over 10
+
+=item 12345678
+
+A
+
+=item B<12345678>
+
+B
+
+=item 1
+
+C
+
+=item B<1>
+
+D
+
+=back
+###
+TAG WIDTH
+ 12345678 A
+
+ 12345678 B
+
+ 1 C
+
+ 1 D
+
+###
diff --git a/cpan/podlators/t/text-encoding.t b/cpan/podlators/t/text-encoding.t
index c803cff1f9..14181e80dd 100644
--- a/cpan/podlators/t/text-encoding.t
+++ b/cpan/podlators/t/text-encoding.t
@@ -2,7 +2,8 @@
#
# text-encoding.t -- Test Pod::Text with various weird encoding combinations.
#
-# Copyright 2002, 2004, 2006, 2007, 2008 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2007, 2008, 2009
+# 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.
@@ -11,40 +12,38 @@ 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 strict;
-use Pod::Text;
+use Test::More;
-$loaded = 1;
-print "ok 1\n";
+# UTF-8 support requires Perl 5.8 or later.
+BEGIN {
+ if ($] < 5.008) {
+ plan skip_all => 'Perl 5.8 required for encoding support';
+ } else {
+ plan tests => 7;
+ }
+}
+BEGIN { use_ok ('Pod::Text') }
-my $n = 2;
eval { binmode (\*DATA, ':raw') };
eval { binmode (\*STDOUT, ':raw') };
+my $builder = Test::More->builder;
+eval { binmode ($builder->output, ':raw') };
+eval { binmode ($builder->failure_output, ':raw') };
+
+my $n = 1;
while (<DATA>) {
my %opts;
- $opts{utf8} = 1 if $n == 4;
- my $parser = Pod::Text->new (%opts) or die "Cannot create parser\n";
+ $opts{utf8} = 1 if $n == 3;
next until $_ eq "###\n";
+ my $parser = Pod::Text->new (%opts);
+ isa_ok ($parser, 'Pod::Text', 'Parser object');
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
eval { binmode (\*TMP, ':raw') };
while (<DATA>) {
@@ -64,18 +63,13 @@ while (<DATA>) {
$output = <TMP>;
}
close TMP;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while 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";
- }
+ is ($output, $expected, "Output correct for test $n");
$n++;
}
diff --git a/cpan/podlators/t/text-options.t b/cpan/podlators/t/text-options.t
index 8a115d83a5..7b70980785 100644
--- a/cpan/podlators/t/text-options.t
+++ b/cpan/podlators/t/text-options.t
@@ -2,7 +2,7 @@
#
# text-options.t -- Additional tests for Pod::Text options.
#
-# Copyright 2002, 2004, 2006, 2008 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2008, 2009 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.
@@ -11,19 +11,15 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..13\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Text;
+use Test::More tests => 19;
+BEGIN { use_ok ('Pod::Text') }
# Redirect stderr to a file.
sub stderr_save {
@@ -38,10 +34,7 @@ sub stderr_restore {
close OLDERR;
}
-$loaded = 1;
-print "ok 1\n";
-
-my $n = 2;
+my $n = 1;
while (<DATA>) {
my %options;
next until $_ eq "###\n";
@@ -56,7 +49,8 @@ while (<DATA>) {
print TMP $_;
}
close TMP;
- my $parser = Pod::Text->new (%options) or die "Cannot create parser\n";
+ my $parser = Pod::Text->new (%options);
+ isa_ok ($parser, 'Pod::Text', 'Parser object');
open (OUT, '> out.tmp') or die "Cannot create out.tmp: $!\n";
stderr_save;
$parser->parse_from_file ('tmp.pod', \*OUT);
@@ -75,13 +69,7 @@ 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++;
+ is ($output, $expected, "Ouput correct for test $n");
open (ERR, 'out.err') or die "Cannot open out.err: $!\n";
my $errors;
{
@@ -89,24 +77,20 @@ while (<DATA>) {
$errors = <ERR>;
}
close ERR;
- unlink ('out.err');
+ 1 while unlink ('out.err');
$expected = '';
while (<DATA>) {
last if $_ eq "###\n";
$expected .= $_;
}
- if ($errors eq $expected) {
- print "ok $n\n";
- } else {
- print "not ok $n\n";
- print "Expected errors:\n ${expected}Errors:\n $errors";
- }
+ is ($errors, $expected, "Errors correct for test $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 ###.
+# options, input, output, and errors are separated by lines containing only
+# ###.
__DATA__
diff --git a/cpan/podlators/t/text-utf8.t b/cpan/podlators/t/text-utf8.t
index 806947827e..4874de5021 100644
--- a/cpan/podlators/t/text-utf8.t
+++ b/cpan/podlators/t/text-utf8.t
@@ -2,7 +2,8 @@
#
# text-utf8.t -- Test Pod::Text with UTF-8 input.
#
-# Copyright 2002, 2004, 2006, 2007, 2008 by Russ Allbery <rra@stanford.edu>
+# Copyright 2002, 2004, 2006, 2007, 2008, 2009
+# 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.
@@ -11,36 +12,33 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..3\n";
-
- # UTF-8 support requires Perl 5.8 or later.
- if ($] < 5.008) {
- my $n;
- for $n (1..3) {
- print "ok $n # skip -- Perl 5.8 required for UTF-8 support\n";
- }
- exit;
- }
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Text;
+use Test::More;
-$loaded = 1;
-print "ok 1\n";
+# UTF-8 support requires Perl 5.8 or later.
+BEGIN {
+ if ($] < 5.008) {
+ plan skip_all => 'Perl 5.8 required for UTF-8 support';
+ } else {
+ plan tests => 4;
+ }
+}
+BEGIN { use_ok ('Pod::Text') }
-my $parser = Pod::Text->new or die "Cannot create parser\n";
-my $n = 2;
+my $parser = Pod::Text->new;
+isa_ok ($parser, 'Pod::Text', 'Parser object');
+my $n = 1;
eval { binmode (\*DATA, ':encoding(utf-8)') };
eval { binmode (\*STDOUT, ':encoding(utf-8)') };
+my $builder = Test::More->builder;
+eval { binmode ($builder->output, ':encoding(utf-8)') };
+eval { binmode ($builder->failure_output, ':encoding(utf-8)') };
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -62,18 +60,13 @@ while (<DATA>) {
$output = <TMP>;
}
close TMP;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while 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";
- }
+ is ($output, $expected, "Output correct for test $n");
$n++;
}
diff --git a/cpan/podlators/t/text.t b/cpan/podlators/t/text.t
index c96acba63d..5b7f4384f7 100644
--- a/cpan/podlators/t/text.t
+++ b/cpan/podlators/t/text.t
@@ -11,26 +11,20 @@ BEGIN {
chdir 't' if -d 't';
if ($ENV{PERL_CORE}) {
@INC = '../lib';
- } else {
- unshift (@INC, '../blib/lib');
}
unshift (@INC, '../blib/lib');
$| = 1;
- print "1..6\n";
}
-END {
- print "not ok 1\n" unless $loaded;
-}
+use strict;
-use Pod::Text;
use Pod::Simple;
+use Test::More tests => 8;
+BEGIN { use_ok ('Pod::Text') }
-$loaded = 1;
-print "ok 1\n";
-
-my $parser = Pod::Text->new or die "Cannot create parser\n";
-my $n = 2;
+my $parser = Pod::Text->new;
+isa_ok ($parser, 'Pod::Text', 'Parser object');
+my $n = 1;
while (<DATA>) {
next until $_ eq "###\n";
open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
@@ -49,20 +43,13 @@ while (<DATA>) {
$output = <TMP>;
}
close TMP;
- unlink ('tmp.pod', 'out.tmp');
+ 1 while unlink ('tmp.pod', 'out.tmp');
my $expected = '';
while (<DATA>) {
last if $_ eq "###\n";
$expected .= $_;
}
- 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";
- }
+ is ($output, $expected, "Output correct for test $n");
$n++;
}
@@ -145,3 +132,13 @@ text
line3
###
+
+###
+=head1 LINK TO URL
+
+This is a L<link|http://www.example.com/> to a URL.
+###
+LINK TO URL
+ This is a link <http://www.example.com/> to a URL.
+
+###
diff --git a/pod/pod2man.PL b/pod/pod2man.PL
index 25df0df0b4..7d7d68f46b 100644..100755
--- a/pod/pod2man.PL
+++ b/pod/pod2man.PL
@@ -351,7 +351,8 @@ documented by this POD page, such as:
Manual page indexers are often extremely picky about the format of this
section, so don't put anything in it except this line. A single dash, and
only a single dash, should separate the list of programs or functions from
-the description. Functions should not be qualified with C<()> or the like.
+the description. Do not use any markup such as CE<lt>E<gt> or
+BE<lt>E<gt>. Functions should not be qualified with C<()> or the like.
The description should ideally fit on a single line, even if a man program
replaces the dash with a few tabs.
diff --git a/pod/pod2text.PL b/pod/pod2text.PL
index ede0fe76b0..ede0fe76b0 100644..100755
--- a/pod/pod2text.PL
+++ b/pod/pod2text.PL