summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/podlators
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/cpan/podlators')
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/Makefile.PL11
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/lib/Pod/Man.pm27
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/lib/Pod/ParseLink.pm8
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text.pm35
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Color.pm9
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Overstrike.pm6
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Termcap.pm72
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/scripts/pod2man.PL28
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/scripts/pod2text.PL4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/docs/pod-spelling.t6
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/docs/pod.t6
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/docs/synopsis.t6
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/docs/urls.t95
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/general/basic.t4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/general/filehandle.t4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/general/pod-parser.t4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/lib/Test/Podlators.pm78
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA.pm83
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/Config.pm16
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/ModuleVersion.pm36
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/man/devise-date.t6
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/man/devise-title.t4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/man/empty.t4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/man/heading.t4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/man/no-encode.t13
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/man/utf8-io.t17
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/parselink/basic.t212
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/style/minimum-version.t6
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/style/module-version.t7
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/style/strict.t50
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/basic.t157
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/color.t4
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/empty.t54
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/encoding.t158
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/options.t368
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/overstrike.t108
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/perlio.t129
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/termcap.t24
-rw-r--r--gnu/usr.bin/perl/cpan/podlators/t/text/utf8.t128
39 files changed, 450 insertions, 1541 deletions
diff --git a/gnu/usr.bin/perl/cpan/podlators/Makefile.PL b/gnu/usr.bin/perl/cpan/podlators/Makefile.PL
index a2008fefc71..ff76df5f9f7 100644
--- a/gnu/usr.bin/perl/cpan/podlators/Makefile.PL
+++ b/gnu/usr.bin/perl/cpan/podlators/Makefile.PL
@@ -4,7 +4,7 @@
# which only supports that build method, and because it is a dependency of
# other build systems like Module::Build.
#
-# Copyright 1999-2001, 2008, 2010, 2012, 2014-2016, 2018
+# Copyright 1999-2001, 2008, 2010, 2012, 2014-2016, 2018-2019
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
@@ -12,7 +12,7 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -89,7 +89,7 @@ my %metadata = (
LICENSE => 'perl_5',
EXE_FILES => [scripts('pod2text', 'pod2man')],
VERSION_FROM => 'lib/Pod/Man.pm',
- MIN_PERL_VERSION => '5.006',
+ MIN_PERL_VERSION => '5.008',
# Use *.PL files to generate the driver scripts so that we get the correct
# invocation of Perl on non-UNIX platforms.
@@ -111,10 +111,7 @@ my %metadata = (
realclean => { FILES => scalar(scripts('pod2text', 'pod2man')) },
# Dependencies on other modules.
- PREREQ_PM => {
- 'Encode' => 0,
- 'Pod::Simple' => 3.06,
- },
+ PREREQ_PM => { 'Pod::Simple' => 3.06 },
# Older versions of ExtUtils::MakeMaker don't pick up nested test
# directories by default.
diff --git a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Man.pm b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Man.pm
index 71798c2533e..d7c029357a2 100644
--- a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Man.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Man.pm
@@ -14,7 +14,7 @@
package Pod::Man;
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -24,7 +24,9 @@ use vars qw(@ISA %ESCAPES $PREAMBLE $VERSION);
use Carp qw(carp croak);
use Pod::Simple ();
-# Conditionally import Encode and set $HAS_ENCODE if it is available.
+# Conditionally import Encode and set $HAS_ENCODE if it is available. This is
+# required to support building as part of Perl core, since podlators is built
+# before Encode is.
our $HAS_ENCODE;
BEGIN {
$HAS_ENCODE = eval { require Encode };
@@ -32,7 +34,7 @@ BEGIN {
@ISA = qw(Pod::Simple);
-$VERSION = '4.11';
+$VERSION = '4.14';
# Set the debugging level. If someone has inserted a debug function into this
# class already, use that. Otherwise, use any Pod::Simple debug function
@@ -245,13 +247,8 @@ sub init_quotes {
sub init_page {
my ($self) = @_;
- # We used to try first to get the version number from a local binary, but
- # we shouldn't need that any more. Get the version from the running Perl.
- # Work a little magic to handle subversions correctly under both the
- # pre-5.6 and the post-5.6 version numbering schemes.
- my @version = ($] =~ /^(\d+)\.(\d{3})(\d{0,3})$/);
- $version[2] ||= 0;
- $version[2] *= 10 ** (3 - length $version[2]);
+ # Get the version from the running Perl.
+ my @version = ($] =~ /^(\d+)\.(\d{3})(\d+)$/);
for (@version) { $_ += 0 }
my $version = join ('.', @version);
@@ -799,7 +796,7 @@ sub start_document {
eval {
my @options = (output => 1, details => 1);
my @layers = PerlIO::get_layers (*{$$self{output_fh}}, @options);
- if ($layers[-1] & PerlIO::F_UTF8 ()) {
+ if ($layers[-1] && ($layers[-1] & PerlIO::F_UTF8 ())) {
$$self{ENCODE} = 0;
}
}
@@ -903,8 +900,6 @@ sub devise_title {
$cut = $i + 1;
$cut++ if ($dirs[$i + 1] && $dirs[$i + 1] eq 'lib');
last;
- } elsif ($dirs[$i] eq 'lib' && $dirs[$i + 1] && $dirs[0] eq 'ext') {
- $cut = $i + 1;
}
}
if ($cut > 0) {
@@ -1883,7 +1878,9 @@ being the file to write the formatted output to.
You can also call parse_lines() to parse an array of lines or
parse_string_document() to parse a document already in memory. As with
parse_file(), parse_lines() and parse_string_document() default to sending
-their output to C<STDOUT> unless changed with the output_fh() method.
+their output to C<STDOUT> unless changed with the output_fh() method. Be
+aware that parse_lines() and parse_string_document() both expect raw bytes,
+not decoded characters.
To put the output from any parse method into a string instead of a file
handle, call the output_string() method instead of output_fh().
@@ -2014,7 +2011,7 @@ are mine).
=head1 COPYRIGHT AND LICENSE
-Copyright 1999-2010, 2012-2018 Russ Allbery <rra@cpan.org>
+Copyright 1999-2010, 2012-2019 Russ Allbery <rra@cpan.org>
Substantial contributions by Sean Burke <sburke@cpan.org>.
diff --git a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/ParseLink.pm b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/ParseLink.pm
index 0be5323973b..273c95847ac 100644
--- a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/ParseLink.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/ParseLink.pm
@@ -13,7 +13,7 @@
package Pod::ParseLink;
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -23,7 +23,7 @@ use Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(parselink);
-$VERSION = '4.11';
+$VERSION = '4.14';
##############################################################################
# Implementation
@@ -167,11 +167,11 @@ L<perlpodspec> for more information.
=head1 AUTHOR
-Russ Allbery <rra@cpan.org>.
+Russ Allbery <rra@cpan.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2001, 2008, 2009, 2014, 2018 Russ Allbery <rra@cpan.org>
+Copyright 2001, 2008, 2009, 2014, 2018-2019 Russ Allbery <rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
diff --git a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text.pm b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text.pm
index b05730ef476..56e6e78a86c 100644
--- a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text.pm
@@ -14,7 +14,7 @@
package Pod::Text;
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -30,7 +30,7 @@ use Pod::Simple ();
# We have to export pod2text for backward compatibility.
@EXPORT = qw(pod2text);
-$VERSION = '4.11';
+$VERSION = '4.14';
# Ensure that $Pod::Simple::nbsp and $Pod::Simple::shy are available. Code
# taken from Pod::Simple 3.32, but was only added in 3.30.
@@ -39,16 +39,8 @@ if ($Pod::Simple::VERSION ge 3.30) {
$NBSP = $Pod::Simple::nbsp;
$SHY = $Pod::Simple::shy;
} else {
- if ($] ge 5.007_003) {
- $NBSP = chr utf8::unicode_to_native(0xA0);
- $SHY = chr utf8::unicode_to_native(0xAD);
- } elsif (Pod::Simple::ASCII) {
- $NBSP = "\xA0";
- $SHY = "\xAD";
- } else {
- $NBSP = "\x41";
- $SHY = "\xCA";
- }
+ $NBSP = chr utf8::unicode_to_native(0xA0);
+ $SHY = chr utf8::unicode_to_native(0xAD);
}
##############################################################################
@@ -247,7 +239,7 @@ sub wrap {
my $spaces = ' ' x $$self{MARGIN};
my $width = $$self{opt_width} - $$self{MARGIN};
while (length > $width) {
- if (s/^([^\n]{0,$width})\s+// || s/^([^\n]{$width})//) {
+ if (s/^([^\n]{0,$width})[ \t\n]+// || s/^([^\n]{$width})//) {
$output .= $spaces . $1 . "\n";
} else {
last;
@@ -265,14 +257,16 @@ sub reformat {
local $_ = shift;
# If we're trying to preserve two spaces after sentences, do some munging
- # to support that. Otherwise, smash all repeated whitespace.
+ # to support that. Otherwise, smash all repeated whitespace. Be careful
+ # not to use \s here, which in Unicode input may match non-breaking spaces
+ # that we don't want to smash.
if ($$self{opt_sentence}) {
s/ +$//mg;
s/\.\n/. \n/g;
s/\n/ /g;
s/ +/ /g;
} else {
- s/\s+/ /g;
+ s/[ \t\n]+/ /g;
}
return $self->wrap ($_);
}
@@ -333,15 +327,14 @@ sub start_document {
# When UTF-8 output is set, check whether our output file handle already
# has a PerlIO encoding layer set. If it does not, we'll need to encode
- # our output before printing it (handled in the output() sub). Wrap the
- # check in an eval to handle versions of Perl without PerlIO.
+ # our output before printing it (handled in the output() sub).
$$self{ENCODE} = 0;
if ($$self{opt_utf8}) {
$$self{ENCODE} = 1;
eval {
my @options = (output => 1, details => 1);
my $flag = (PerlIO::get_layers ($$self{output_fh}, @options))[-1];
- if ($flag & PerlIO::F_UTF8 ()) {
+ if ($flag && ($flag & PerlIO::F_UTF8 ())) {
$$self{ENCODE} = 0;
$$self{ENCODING} = 'UTF-8';
}
@@ -919,7 +912,9 @@ being the file to write the formatted output to.
You can also call parse_lines() to parse an array of lines or
parse_string_document() to parse a document already in memory. As with
parse_file(), parse_lines() and parse_string_document() default to sending
-their output to C<STDOUT> unless changed with the output_fh() method.
+their output to C<STDOUT> unless changed with the output_fh() method. Be
+aware that parse_lines() and parse_string_document() both expect raw bytes,
+not decoded characters.
To put the output from any parse method into a string instead of a file
handle, call the output_string() method instead of output_fh().
@@ -1006,7 +1001,7 @@ how to use Pod::Simple.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999-2002, 2004, 2006, 2008-2009, 2012-2016, 2018 Russ Allbery
+Copyright 1999-2002, 2004, 2006, 2008-2009, 2012-2016, 2018-2019 Russ Allbery
<rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
diff --git a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Color.pm b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Color.pm
index 8d956f2a5dd..5d47c5ecb3b 100644
--- a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Color.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Color.pm
@@ -12,7 +12,7 @@
package Pod::Text::Color;
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -23,7 +23,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '4.11';
+$VERSION = '4.14';
##############################################################################
# Overrides
@@ -97,9 +97,6 @@ sub wrap {
# $shortchar matches some sequence of $char ending in codes followed by
# whitespace or the end of the string. $longchar matches exactly $width
# $chars, used when we have to truncate and hard wrap.
- #
- # $shortchar and $longchar are created in a slightly odd way because the
- # construct ${char}{0,$width} didn't do the right thing until Perl 5.8.x.
my $code = '(?:\e\[[\d;]+m)';
my $char = "(?>$code*[^\\n])";
my $shortchar = '^(' . $char . "{0,$width}(?>$code*)" . ')(?:\s+|\z)';
@@ -185,7 +182,7 @@ Russ Allbery <rra@cpan.org>.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2001, 2004, 2006, 2008, 2009, 2018 Russ Allbery
+Copyright 1999, 2001, 2004, 2006, 2008, 2009, 2018-2019 Russ Allbery
<rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
diff --git a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Overstrike.pm b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Overstrike.pm
index 92a3a9330e0..53bc6afef23 100644
--- a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Overstrike.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Overstrike.pm
@@ -19,7 +19,7 @@
package Pod::Text::Overstrike;
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -29,7 +29,7 @@ use Pod::Text ();
@ISA = qw(Pod::Text);
-$VERSION = '4.11';
+$VERSION = '4.14';
##############################################################################
# Overrides
@@ -185,7 +185,7 @@ created by Russ Allbery <rra@cpan.org>. Subsequently updated by Russ Allbery.
Copyright 2000 by Joe Smith <Joe.Smith@inwap.com>
-Copyright 2001, 2004, 2008, 2014, 2018 by Russ Allbery <rra@cpan.org>
+Copyright 2001, 2004, 2008, 2014, 2018-2019 by Russ Allbery <rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
diff --git a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Termcap.pm b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Termcap.pm
index d36ba4f518a..be218f0bf04 100644
--- a/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Termcap.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/lib/Pod/Text/Termcap.pm
@@ -12,7 +12,7 @@
package Pod::Text::Termcap;
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -24,7 +24,7 @@ use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Text);
-$VERSION = '4.11';
+$VERSION = '4.14';
##############################################################################
# Overrides
@@ -36,14 +36,6 @@ sub new {
my ($self, %args) = @_;
my ($ospeed, $term, $termios);
- # $ENV{HOME} is usually not set on Windows. The default Term::Cap path
- # may not work on Solaris.
- unless (exists $ENV{TERMPATH}) {
- my $home = exists $ENV{HOME} ? "$ENV{HOME}/.termcap:" : '';
- $ENV{TERMPATH} =
- "${home}/etc/termcap:/usr/share/misc/termcap:/usr/share/lib/termcap";
- }
-
# Fall back on a hard-coded terminal speed if POSIX::Termios isn't
# available (such as on VMS).
eval { $termios = POSIX::Termios->new };
@@ -80,10 +72,12 @@ sub new {
# Initialize Pod::Text.
$self = $self->SUPER::new (%args);
- # Fall back on the ANSI escape sequences if Term::Cap doesn't work.
- $$self{BOLD} = $bold || "\e[1m";
- $$self{UNDL} = $undl || "\e[4m";
- $$self{NORM} = $norm || "\e[m";
+ # If we were unable to get any of the formatting sequences, don't attempt
+ # that type of formatting. This will do weird things if bold or underline
+ # were available but normal wasn't, but hopefully that will never happen.
+ $$self{BOLD} = $bold || q{};
+ $$self{UNDL} = $undl || q{};
+ $$self{NORM} = $norm || q{};
return $self;
}
@@ -106,11 +100,19 @@ sub cmd_head2 {
sub cmd_b { my $self = shift; return "$$self{BOLD}$_[1]$$self{NORM}" }
sub cmd_i { my $self = shift; return "$$self{UNDL}$_[1]$$self{NORM}" }
+# Return a regex that matches a formatting sequence. This will only be valid
+# if we were able to get at least some termcap information.
+sub format_regex {
+ my ($self) = @_;
+ my @codes = ($self->{BOLD}, $self->{UNDL}, $self->{NORM});
+ return join(q{|}, map { $_ eq q{} ? () : "\Q$_\E" } @codes);
+}
+
# Analyze a single line and return any formatting codes in effect at the end
# of that line.
sub end_format {
my ($self, $line) = @_;
- my $pattern = "(\Q$$self{BOLD}\E|\Q$$self{UNDL}\E|\Q$$self{NORM}\E)";
+ my $pattern = "(" . $self->format_regex() . ")";
my $current;
while ($line =~ /$pattern/g) {
my $code = $1;
@@ -147,15 +149,17 @@ sub wrap {
my $spaces = ' ' x $$self{MARGIN};
my $width = $$self{opt_width} - $$self{MARGIN};
+ # If we were unable to find any termcap sequences, use Pod::Text wrapping.
+ if ($self->{BOLD} eq q{} && $self->{UNDL} eq q{} && $self->{NORM} eq q{}) {
+ return $self->SUPER::wrap($_);
+ }
+
# $code matches a single special sequence. $char matches any number of
# special sequences preceding a single character other than a newline.
# $shortchar matches some sequence of $char ending in codes followed by
# whitespace or the end of the string. $longchar matches exactly $width
# $chars, used when we have to truncate and hard wrap.
- #
- # $shortchar and $longchar are created in a slightly odd way because the
- # construct ${char}{0,$width} didn't do the right thing until Perl 5.8.x.
- my $code = "(?:\Q$$self{BOLD}\E|\Q$$self{UNDL}\E|\Q$$self{NORM}\E)";
+ my $code = "(?:" . $self->format_regex() . ")";
my $char = "(?>$code*[^\\n])";
my $shortchar = '^(' . $char . "{0,$width}(?>$code*)" . ')(?:\s+|\z)';
my $longchar = '^(' . $char . "{$width})";
@@ -225,34 +229,20 @@ text using the correct termcap escape sequences for the current terminal.
Apart from the format codes, it in all ways functions like Pod::Text. See
L<Pod::Text> for details and available options.
-=head1 ENVIRONMENT
-
-This module sets the TERMPATH environment variable globally to:
-
- $HOME/.termcap:/etc/termcap:/usr/share/misc/termcap:/usr/share/lib/termcap
-
-if it isn't already set. (The first entry is omitted if the HOME
-environment variable isn't set.) This is a (very old) workaround for
-problems finding termcap information on older versions of Solaris, and is
-not good module behavior. Please do not rely on this behavior; it may be
-dropped in a future release.
-
-=head1 NOTES
-
-This module uses Term::Cap to retrieve the formatting escape sequences for
-the current terminal, and falls back on the ECMA-48 (the same in this
-regard as ANSI X3.64 and ISO 6429, the escape codes also used by DEC VT100
-terminals) if the bold, underline, and reset codes aren't set in the
-termcap information.
+This module uses L<Term::Cap> to find the correct terminal settings. See the
+documentation of that module for how it finds terminal database information
+and how to override that behavior if necessary. If unable to find control
+strings for bold and underscore formatting, that formatting is skipped,
+resulting in the same output as Pod::Text.
=head1 AUTHOR
-Russ Allbery <rra@cpan.org>.
+Russ Allbery <rra@cpan.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 1999, 2001-2002, 2004, 2006, 2008-2009, 2014-2015, 2018 Russ Allbery
-<rra@cpan.org>
+Copyright 1999, 2001-2002, 2004, 2006, 2008-2009, 2014-2015, 2018-2019 Russ
+Allbery <rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
diff --git a/gnu/usr.bin/perl/cpan/podlators/scripts/pod2man.PL b/gnu/usr.bin/perl/cpan/podlators/scripts/pod2man.PL
index cc6f955350d..d6e685d2010 100644
--- a/gnu/usr.bin/perl/cpan/podlators/scripts/pod2man.PL
+++ b/gnu/usr.bin/perl/cpan/podlators/scripts/pod2man.PL
@@ -4,7 +4,7 @@
# required for proper start-up code on non-UNIX platforms, and is used inside
# Perl core.
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -71,13 +71,12 @@ my $stdin;
# Parse our options, trying to retain backward compatibility with pod2man but
# allowing short forms as well. --lax is currently ignored.
my %options;
-$options{utf8} = 1;
Getopt::Long::config ('bundling_override');
GetOptions (\%options, 'center|c=s', 'date|d=s', 'errors=s', 'fixed=s',
'fixedbold=s', 'fixeditalic=s', 'fixedbolditalic=s', 'help|h',
'lax|l', 'lquote=s', 'name|n=s', 'nourls', 'official|o',
'quotes|q=s', 'release|r=s', 'rquote=s', 'section|s=s', 'stderr',
- 'verbose|v', 'utf8|u!')
+ 'verbose|v', 'utf8|u')
or exit 1;
pod2usage (0) if $options{help};
@@ -127,7 +126,7 @@ exit $status;
__END__
=for stopwords
-en em --stderr stderr --no-utf8 UTF-8 overdo markup MT-LEVEL Allbery Solaris URL
+en em --stderr stderr --utf8 UTF-8 overdo markup MT-LEVEL Allbery Solaris URL
troff troff-specific formatters uppercased Christiansen --nourls UTC prepend
lquote rquote
@@ -142,7 +141,7 @@ pod2man [B<--center>=I<string>] [B<--date>=I<string>] [B<--errors>=I<style>]
[B<--fixedbolditalic>=I<font>] [B<--name>=I<name>] [B<--nourls>]
[B<--official>] [B<--release>=I<version>] [B<--section>=I<manext>]
[B<--quotes>=I<quotes>] [B<--lquote>=I<quote>] [B<--rquote>=I<quote>]
- [B<--stderr>] [B<--no-utf8>] [B<--verbose>] [I<input> [I<output>] ...]
+ [B<--stderr>] [B<--utf8>] [B<--verbose>] [I<input> [I<output>] ...]
pod2man B<--help>
@@ -345,10 +344,19 @@ to C<--errors=stderr> and is supported for backward compatibility.
=item B<-u>, B<--utf8>
-This option allows B<pod2man> to output literal UTF-8 characters.
-On OpenBSD, it is enabled by default and can be disabled with
-B<--no-utf8>, in which case non-ASCII characters are converted
-either to *roff escape sequences or to C<X>.
+By default, B<pod2man> produces the most conservative possible *roff
+output to try to ensure that it will work with as many different *roff
+implementations as possible. Many *roff implementations cannot handle
+non-ASCII characters, so this means all non-ASCII characters are converted
+either to a *roff escape sequence that tries to create a properly accented
+character (at least for troff output) or to C<X>.
+
+This option says to instead output literal UTF-8 characters. If your
+*roff implementation can handle it, this is the best output format to use
+and avoids corruption of documents containing non-ASCII characters.
+However, be warned that *roff source with literal UTF-8 characters is not
+supported by many implementations and may even result in segfaults and
+other bad behavior.
Be aware that, when using this option, the input encoding of your POD
source should be properly declared unless it's US-ASCII. Pod::Simple will
@@ -409,7 +417,7 @@ B<pod2man> by Larry Wall and Tom Christiansen.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999-2001, 2004, 2006, 2008, 2010, 2012-2018 Russ Allbery
+Copyright 1999-2001, 2004, 2006, 2008, 2010, 2012-2019 Russ Allbery
<rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
diff --git a/gnu/usr.bin/perl/cpan/podlators/scripts/pod2text.PL b/gnu/usr.bin/perl/cpan/podlators/scripts/pod2text.PL
index bae85741523..be06960ad76 100644
--- a/gnu/usr.bin/perl/cpan/podlators/scripts/pod2text.PL
+++ b/gnu/usr.bin/perl/cpan/podlators/scripts/pod2text.PL
@@ -4,7 +4,7 @@
# required for proper start-up code on non-UNIX platforms, and is used inside
# Perl core.
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -346,7 +346,7 @@ Russ Allbery <rra@cpan.org>.
=head1 COPYRIGHT AND LICENSE
-Copyright 1999-2001, 2004, 2006, 2008, 2010, 2012-2018 Russ Allbery
+Copyright 1999-2001, 2004, 2006, 2008, 2010, 2012-2019 Russ Allbery
<rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/docs/pod-spelling.t b/gnu/usr.bin/perl/cpan/podlators/t/docs/pod-spelling.t
index 94d75035bc6..819aa693314 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/docs/pod-spelling.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/docs/pod-spelling.t
@@ -6,6 +6,7 @@
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2019 Russ Allbery <eagle@eyrie.org>
# Copyright 2013-2014
# The Board of Trustees of the Leland Stanford Junior University
#
@@ -29,15 +30,16 @@
#
# SPDX-License-Identifier: MIT
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
-use Test::More;
use Test::RRA qw(skip_unless_author use_prereq);
+use Test::More;
+
# Only run this test for the module author since the required stopwords are
# too sensitive to the exact spell-checking program and dictionary.
skip_unless_author('Spelling tests');
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/docs/pod.t b/gnu/usr.bin/perl/cpan/podlators/t/docs/pod.t
index 5fcfcdf77cf..e7d02316606 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/docs/pod.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/docs/pod.t
@@ -6,6 +6,7 @@
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2019 Russ Allbery <eagle@eyrie.org>
# Copyright 2012-2014
# The Board of Trustees of the Leland Stanford Junior University
#
@@ -29,15 +30,16 @@
#
# SPDX-License-Identifier: MIT
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
-use Test::More;
use Test::RRA qw(skip_unless_automated use_prereq);
+use Test::More;
+
# Skip this test for normal user installs, although pod2man may still fail.
skip_unless_automated('POD syntax tests');
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/docs/synopsis.t b/gnu/usr.bin/perl/cpan/podlators/t/docs/synopsis.t
index 43a8354ba40..1a2fbf1af28 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/docs/synopsis.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/docs/synopsis.t
@@ -6,6 +6,7 @@
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2019 Russ Allbery <eagle@eyrie.org>
# Copyright 2013-2014
# The Board of Trustees of the Leland Stanford Junior University
#
@@ -29,15 +30,16 @@
#
# SPDX-License-Identifier: MIT
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
+use Test::RRA qw(skip_unless_automated use_prereq);
+
use File::Spec;
use Test::More;
-use Test::RRA qw(skip_unless_automated use_prereq);
# Skip for normal user installs since this doesn't affect functionality.
skip_unless_automated('Synopsis syntax tests');
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/docs/urls.t b/gnu/usr.bin/perl/cpan/podlators/t/docs/urls.t
deleted file mode 100644
index a654c5453c2..00000000000
--- a/gnu/usr.bin/perl/cpan/podlators/t/docs/urls.t
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/perl
-#
-# Check URLs in source files.
-#
-# Examine all source files in a distribution for bad URL patterns and report
-# on files that fail this check. Currently, this just checks that all the
-# links to www.eyrie.org are https.
-#
-# The canonical version of this file is maintained in the rra-c-util package,
-# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
-#
-# Copyright 2016 Russ Allbery <eagle@eyrie.org>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-# SPDX-License-Identifier: MIT
-
-use 5.006;
-use strict;
-use warnings;
-
-use lib 't/lib';
-
-use File::Find qw(find);
-use Test::More;
-use Test::RRA qw(skip_unless_automated);
-
-# Bad patterns to search for.
-my @BAD_REGEXES = (qr{ http:// \S+ [.]eyrie[.]org }xms);
-my @BAD_STRINGS = qw(rra@stanford.edu);
-
-# File or directory names to always skip.
-my %SKIP = map { $_ => 1 } qw(.git _build blib cover_db);
-
-# Only run this test during automated testing, since failure doesn't indicate
-# any user-noticable flaw in the package itself.
-skip_unless_automated('Documentation URL tests');
-
-# Scan files for bad URL patterns. This is meant to be run as the wanted
-# function from File::Find.
-sub check_file {
- my $filename = $_;
-
- # Ignore this check itself (or the non-Perl version of it). Ignore any
- # directories or binary files. Ignore and prune any skipped files.
- if ($SKIP{$filename}) {
- $File::Find::prune = 1;
- return;
- }
- return if -d $filename;
- return if !-T $filename;
- return if ($filename eq 'urls.t' || $filename eq 'urls-t');
-
- # Scan the file.
- open(my $fh, '<', $filename) or BAIL_OUT("Cannot open $File::Find::name");
- while (defined(my $line = <$fh>)) {
- for my $regex (@BAD_REGEXES) {
- if ($line =~ $regex) {
- ok(0, "$File::Find::name contains $regex");
- close($fh) or BAIL_OUT("Cannot close $File::Find::name");
- return;
- }
- }
- for my $string (@BAD_STRINGS) {
- if (index($line, $string) != -1) {
- ok(0, "$File::Find::name contains $string");
- close($fh) or BAIL_OUT("Cannot close $File::Find::name");
- return;
- }
- }
- }
- close($fh) or BAIL_OUT("Cannot close $File::Find::name");
- ok(1, $File::Find::name);
- return;
-}
-
-# Use File::Find to scan all files from the top of the directory.
-find(\&check_file, q{.});
-done_testing();
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/general/basic.t b/gnu/usr.bin/perl/cpan/podlators/t/general/basic.t
index 717e3762dfd..d4978bcf366 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/general/basic.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/general/basic.t
@@ -12,7 +12,7 @@
# the machinery to run small POD snippets through the specific formatter being
# tested should probably be used instead.
#
-# Copyright 2001-2002, 2004, 2006, 2009, 2012, 2014-2015, 2018
+# Copyright 2001-2002, 2004, 2006, 2009, 2012, 2014-2015, 2018-2019
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
@@ -20,7 +20,7 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/general/filehandle.t b/gnu/usr.bin/perl/cpan/podlators/t/general/filehandle.t
index 42601a05878..3c5d753a480 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/general/filehandle.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/general/filehandle.t
@@ -6,14 +6,14 @@
# Pod::Man and Pod::Text had to implement it directly. Test to be sure it's
# working properly.
#
-# Copyright 2006, 2009, 2012, 2014-2016, 2018 Russ Allbery <rra@cpan.org>
+# Copyright 2006, 2009, 2012, 2014-2016, 2018-2019 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/general/pod-parser.t b/gnu/usr.bin/perl/cpan/podlators/t/general/pod-parser.t
index 9c51aff87a4..c008499298e 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/general/pod-parser.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/general/pod-parser.t
@@ -2,14 +2,14 @@
#
# Tests for backward compatibility with Pod::Parser.
#
-# Copyright 2006, 2008-2009, 2012, 2015, 2018 by Russ Allbery <rra@cpan.org>
+# Copyright 2006, 2008-2009, 2012, 2015, 2018-2019 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/Podlators.pm b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/Podlators.pm
index 3ae940924e2..9254f26468e 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/Podlators.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/Podlators.pm
@@ -8,7 +8,7 @@
package Test::Podlators;
-use 5.006;
+use 5.008;
use strict;
use warnings;
@@ -91,7 +91,6 @@ sub _stderr_restore {
# For the format, see t/data/snippets/README.
#
# $path - Relative path to read test data from
-# $encoding - Encoding of snippet (UTF-8 if not specified)
#
# Returns: Reference to hash of test data with the following keys:
# name - Name of the test for status reporting
@@ -101,20 +100,18 @@ sub _stderr_restore {
# errors - Expected errors
# exception - Text of exception (with file and line stripped)
sub read_snippet {
- my ($path, $encoding) = @_;
+ my ($path) = @_;
$path = File::Spec->catfile('t', 'data', 'snippets', $path);
- $encoding ||= 'UTF-8';
my %data;
# Read the sections and store them in the %data hash.
my ($line, $section);
open(my $fh, '<', $path) or BAIL_OUT("cannot open $path: $!");
while (defined($line = <$fh>)) {
- $line = decode($encoding, $line);
if ($line =~ m{ \A \s* \[ (\S+) \] \s* \z }xms) {
$section = $1;
+ $data{$section} = q{};
} elsif ($section) {
- $data{$section} ||= q{};
$data{$section} .= $line;
}
}
@@ -248,11 +245,17 @@ sub slurp {
# $class - Class name of the formatter, as a string
# $snippet - Path to the snippet file defining the test
# $options_ref - Hash of options with the following keys:
-# encoding - Set to use a non-standard encoding
+# encoding - Expect the output to be in this non-standard encoding
sub test_snippet {
my ($class, $snippet, $options_ref) = @_;
- my $encoding = defined($options_ref) ? $options_ref->{encoding} : undef;
- my $data_ref = read_snippet($snippet, $encoding);
+ my $data_ref = read_snippet($snippet);
+
+ # Determine the encoding to expect for the output portion of the snippet.
+ my $encoding;
+ if (defined($options_ref)) {
+ $encoding = $options_ref->{encoding};
+ }
+ $encoding ||= 'UTF-8';
# Create the formatter object.
my $parser = $class->new(%{ $data_ref->{options} }, name => 'TEST');
@@ -277,9 +280,10 @@ sub test_snippet {
$got =~ s{ \n\s+ \z }{\n}xms;
# Check the output, errors, and any exception.
- is($got, $data_ref->{output}, "$data_ref->{name}: output");
- if ($data_ref->{errors}) {
- is($stderr, $data_ref->{errors}, "$data_ref->{name}: errors");
+ my $expected = decode($encoding, $data_ref->{output});
+ is($got, $expected, "$data_ref->{name}: output");
+ if ($data_ref->{errors} || $stderr) {
+ is($stderr, $data_ref->{errors} || q{}, "$data_ref->{name}: errors");
}
if ($data_ref->{exception} || $exception) {
if ($exception) {
@@ -299,11 +303,19 @@ sub test_snippet {
# $class - Class name of the formatter, as a string
# $snippet - Path to the snippet file defining the test
# $options_ref - Hash of options with the following keys:
+# encoding - Expect the snippet to be in this non-standard encoding
# perlio_utf8 - Set to 1 to set a PerlIO UTF-8 encoding on the output file
sub test_snippet_with_io {
my ($class, $snippet, $options_ref) = @_;
my $data_ref = read_snippet($snippet);
+ # Determine the encoding to expect for the output portion of the snippet.
+ my $encoding;
+ if (defined($options_ref)) {
+ $encoding = $options_ref->{encoding};
+ }
+ $encoding ||= 'UTF-8';
+
# Create the formatter object.
my $parser = $class->new(%{ $data_ref->{options} }, name => 'TEST');
isa_ok($parser, $class, 'Parser object');
@@ -317,7 +329,7 @@ sub test_snippet_with_io {
my $input_file = File::Spec->catfile('t', 'tmp', "tmp$$.pod");
open(my $input, '>', $input_file)
or BAIL_OUT("cannot create $input_file: $!");
- print {$input} encode('UTF-8', $data_ref->{input})
+ print {$input} $data_ref->{input}
or BAIL_OUT("cannot write to $input_file: $!");
close($input) or BAIL_OUT("cannot flush output to $input_file: $!");
@@ -336,20 +348,23 @@ sub test_snippet_with_io {
$parser->parse_from_file($input_file, $output);
close($output) or BAIL_OUT("cannot flush output to $output_file: $!");
- # Read back in the results, checking to ensure that we didn't output the
- # accent definitions if we wrote UTF-8 output.
+ # Read back in the results. For Pod::Man, also ensure that we didn't
+ # output the accent definitions if we wrote UTF-8 output.
open(my $results, '<', $output_file)
or BAIL_OUT("cannot open $output_file: $!");
my ($line, $saw_accents);
- while (defined($line = <$results>)) {
- $line = decode('UTF-8', $line);
- if ($line =~ m{ Accent [ ] mark [ ] definitions }xms) {
- $saw_accents = 1;
+ if ($class eq 'Pod::Man') {
+ while (defined($line = <$results>)) {
+ $line = decode('UTF-8', $line);
+ if ($line =~ m{ Accent [ ] mark [ ] definitions }xms) {
+ $saw_accents = 1;
+ }
+ last if $line =~ m{ \A [.]nh }xms;
}
- last if $line =~ m{ \A [.]nh }xms;
}
my $saw = do { local $/ = undef; <$results> };
$saw = decode('UTF-8', $saw);
+ $saw =~ s{ \n\s+ \z }{\n}xms;
close($results) or BAIL_OUT("cannot close output file: $!");
# Clean up.
@@ -357,12 +372,18 @@ sub test_snippet_with_io {
# Check the accent definitions and the output.
my $perlio = $options_ref->{perlio_utf8} ? ' (PerlIO)' : q{};
+ if ($class eq 'Pod::Man') {
+ is(
+ $saw_accents,
+ $data_ref->{options}{utf8} ? undef : 1,
+ "$data_ref->{name}: accent definitions$perlio"
+ );
+ }
is(
- $saw_accents,
- $data_ref->{options}{utf8} ? undef : 1,
- "$data_ref->{name}: accent definitions$perlio"
+ $saw,
+ decode($encoding, $data_ref->{output}),
+ "$data_ref->{name}: output$perlio"
);
- is($saw, $data_ref->{output}, "$data_ref->{name}: output$perlio");
return;
}
@@ -396,15 +417,12 @@ should be explicitly imported.
=over 4
-=item read_snippet(PATH[, ENCODING])
+=item read_snippet(PATH)
Read one test snippet from the provided relative file name and return it. The
path should be relative to F<t/data/snippets>. For the format, see
F<t/data/snippets/README>.
-ENCODING, if present, specifies the encoding of the snippet. If not given,
-the snippet is assumed to be encoded in C<UTF-8>.
-
The result will be a hash with the following keys:
=over 4
@@ -489,7 +507,7 @@ it, and checking the results. Results are reported with Test::More.
OPTIONS, if present, is a reference to a hash of options. Currently, only
one key is supported: C<encoding>, which, if set, specifies the encoding of
-the snippet.
+the output portion of the snippet.
=item test_snippet_with_io(CLASS, SNIPPET[, OPTIONS])
@@ -509,7 +527,7 @@ Russ Allbery <rra@cpan.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2015, 2016, 2018 Russ Allbery <rra@cpan.org>
+Copyright 2015-2016, 2018-2020 Russ Allbery <rra@cpan.org>
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA.pm b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA.pm
index cbfdc42603c..1d5e4db23d4 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA.pm
@@ -10,25 +10,41 @@
package Test::RRA;
-use 5.006;
+use 5.008;
+use base qw(Exporter);
use strict;
use warnings;
-use Exporter;
+use Carp qw(croak);
use File::Temp;
-use Test::More;
-# For Perl 5.006 compatibility.
-## no critic (ClassHierarchies::ProhibitExplicitISA)
+# Abort if Test::More was loaded before Test::RRA to be sure that we get the
+# benefits of the Test::More probing below.
+if ($INC{'Test/More.pm'}) {
+ croak('Test::More loaded before Test::RRA');
+}
+
+# Red Hat's base perl package doesn't include Test::More (one has to install
+# the perl-core package in addition). Try to detect this and skip any Perl
+# tests if Test::More is not present. This relies on Test::RRA being included
+# before Test::More.
+eval {
+ require Test::More;
+ Test::More->import();
+};
+if ($@) {
+ print "1..0 # SKIP Test::More required for test\n"
+ or croak('Cannot write to stdout');
+ exit 0;
+}
# Declare variables that should be set in BEGIN for robustness.
-our (@EXPORT_OK, @ISA, $VERSION);
+our (@EXPORT_OK, $VERSION);
# Set $VERSION and everything export-related in a BEGIN block for robustness
# against circular module loading (not that we load any modules, but
# consistency is good).
BEGIN {
- @ISA = qw(Exporter);
@EXPORT_OK = qw(
is_file_contents skip_unless_author skip_unless_automated use_prereq
);
@@ -36,7 +52,7 @@ BEGIN {
# This version should match the corresponding rra-c-util release, but with
# two digits for the minor version, including a leading zero if necessary,
# so that it will sort properly.
- $VERSION = '7.01';
+ $VERSION = '8.01';
}
# Compare a string to the contents of a file, similar to the standard is()
@@ -61,22 +77,27 @@ sub is_file_contents {
return;
}
- # Otherwise, we show a diff, but only if we have IPC::System::Simple.
- eval { require IPC::System::Simple };
+ # Otherwise, we show a diff, but only if we have IPC::System::Simple and
+ # diff succeeds. Otherwise, we fall back on showing the full expected and
+ # seen output.
+ eval {
+ require IPC::System::Simple;
+
+ my $tmp = File::Temp->new();
+ my $tmpname = $tmp->filename;
+ print {$tmp} $got or BAIL_OUT("Cannot write to $tmpname: $!\n");
+ my @command = ('diff', '-u', $expected, $tmpname);
+ my $diff = IPC::System::Simple::capturex([0 .. 1], @command);
+ diag($diff);
+ };
if ($@) {
- ok(0, $message);
- return;
+ diag('Expected:');
+ diag($expected);
+ diag('Seen:');
+ diag($data);
}
- # They're not equal. Write out what we got so that we can run diff.
- my $tmp = File::Temp->new();
- my $tmpname = $tmp->filename;
- print {$tmp} $got or BAIL_OUT("Cannot write to $tmpname: $!\n");
- my @command = ('diff', '-u', $expected, $tmpname);
- my $diff = IPC::System::Simple::capturex([0 .. 1], @command);
- diag($diff);
-
- # Remove the temporary file and report failure.
+ # Report failure.
ok(0, $message);
return;
}
@@ -91,7 +112,7 @@ sub is_file_contents {
sub skip_unless_author {
my ($description) = @_;
if (!$ENV{AUTHOR_TESTING}) {
- plan skip_all => "$description only run for author";
+ plan(skip_all => "$description only run for author");
}
return;
}
@@ -110,7 +131,7 @@ sub skip_unless_automated {
for my $env (qw(AUTOMATED_TESTING RELEASE_TESTING AUTHOR_TESTING)) {
return if $ENV{$env};
}
- plan skip_all => "$description normally skipped";
+ plan(skip_all => "$description normally skipped");
return;
}
@@ -152,14 +173,14 @@ sub use_prereq {
use $module $version \@imports;
1;
};
- $error = $@;
+ $error = $@;
$sigdie = $SIG{__DIE__} || undef;
}
# If the use failed for any reason, skip the test.
if (!$result || $error) {
my $name = length($version) > 0 ? "$module $version" : $module;
- plan skip_all => "$name required for test";
+ plan(skip_all => "$name required for test");
}
# If the module set $SIG{__DIE__}, we cleared that via local. Restore it.
@@ -202,6 +223,14 @@ This module collects utility functions that are useful for Perl test scripts.
It assumes Russ Allbery's Perl module layout and test conventions and will
only be useful for other people if they use the same conventions.
+This module B<must> be loaded before Test::More or it will abort during
+import. It will skip the test (by printing a skip message to standard output
+and exiting with status 0, equivalent to C<plan skip_all>) during import if
+Test::More is not available. This allows tests written in Perl using this
+module to be skipped if run on a system with Perl but not Test::More, such as
+Red Hat systems with the C<perl> package but not the C<perl-core> package
+installed.
+
=head1 FUNCTIONS
None of these functions are imported by default. The ones used by a script
@@ -246,7 +275,9 @@ Russ Allbery <eagle@eyrie.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2013, 2014 The Board of Trustees of the Leland Stanford Junior
+Copyright 2016, 2018-2019 Russ Allbery <eagle@eyrie.org>
+
+Copyright 2013-2014 The Board of Trustees of the Leland Stanford Junior
University
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/Config.pm b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/Config.pm
index b2f94466dd2..80a15739410 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/Config.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/Config.pm
@@ -9,24 +9,20 @@
package Test::RRA::Config;
-use 5.006;
+use 5.008;
+use base qw(Exporter);
use strict;
use warnings;
-# For Perl 5.006 compatibility.
-## no critic (ClassHierarchies::ProhibitExplicitISA)
-
-use Exporter;
use Test::More;
# Declare variables that should be set in BEGIN for robustness.
-our (@EXPORT_OK, @ISA, $VERSION);
+our (@EXPORT_OK, $VERSION);
# Set $VERSION and everything export-related in a BEGIN block for robustness
# against circular module loading (not that we load any modules, but
# consistency is good).
BEGIN {
- @ISA = qw(Exporter);
@EXPORT_OK = qw(
$COVERAGE_LEVEL @COVERAGE_SKIP_TESTS @CRITIC_IGNORE $LIBRARY_PATH
$MINIMUM_VERSION %MINIMUM_VERSION @MODULE_VERSION_IGNORE
@@ -36,7 +32,7 @@ BEGIN {
# This version should match the corresponding rra-c-util release, but with
# two digits for the minor version, including a leading zero if necessary,
# so that it will sort properly.
- $VERSION = '7.01';
+ $VERSION = '8.01';
}
# If C_TAP_BUILD or C_TAP_SOURCE are set in the environment, look for
@@ -187,9 +183,9 @@ Russ Allbery <eagle@eyrie.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2015, 2016 Russ Allbery <eagle@eyrie.org>
+Copyright 2015-2016, 2019 Russ Allbery <eagle@eyrie.org>
-Copyright 2013, 2014 The Board of Trustees of the Leland Stanford Junior
+Copyright 2013-2014 The Board of Trustees of the Leland Stanford Junior
University
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/ModuleVersion.pm b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/ModuleVersion.pm
index 3b3d6742df9..fc8bfbc8de5 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/ModuleVersion.pm
+++ b/gnu/usr.bin/perl/cpan/podlators/t/lib/Test/RRA/ModuleVersion.pm
@@ -8,32 +8,28 @@
package Test::RRA::ModuleVersion;
-use 5.006;
+use 5.008;
+use base qw(Exporter);
use strict;
use warnings;
-use Exporter;
use File::Find qw(find);
use Test::More;
use Test::RRA::Config qw(@MODULE_VERSION_IGNORE);
-# For Perl 5.006 compatibility.
-## no critic (ClassHierarchies::ProhibitExplicitISA)
-
# Declare variables that should be set in BEGIN for robustness.
-our (@EXPORT_OK, @ISA, $VERSION);
+our (@EXPORT_OK, $VERSION);
# Set $VERSION and everything export-related in a BEGIN block for robustness
# against circular module loading (not that we load any modules, but
# consistency is good).
BEGIN {
- @ISA = qw(Exporter);
@EXPORT_OK = qw(test_module_versions update_module_versions);
# This version should match the corresponding rra-c-util release, but with
# two digits for the minor version, including a leading zero if necessary,
# so that it will sort properly.
- $VERSION = '7.01';
+ $VERSION = '8.01';
}
# A regular expression matching the version string for a module using the
@@ -129,21 +125,23 @@ sub _module_version {
# Throws: Text exception on I/O failure or inability to find version
sub _update_module_version {
my ($file, $version) = @_;
- open(my $in, q{<}, $file) or die "$0: cannot open $file: $!\n";
- open(my $out, q{>}, "$file.new")
- or die "$0: cannot create $file.new: $!\n";
- # If the version starts with v, use it without quotes. Otherwise, quote
- # it to prevent removal of trailing zeroes.
- if ($version !~ m{ \A v }xms) {
- $version = "'$version'";
+ # The old-style syntax may require different quoting. If the version
+ # starts with v, use it without quotes. Otherwise, quote it to prevent
+ # removal of trailing zeroes.
+ my $old_version = $version;
+ if ($old_version !~ m{ \A v }xms) {
+ $old_version = "'$old_version'";
}
# Scan for the version and replace it.
+ open(my $in, q{<}, $file) or die "$0: cannot open $file: $!\n";
+ open(my $out, q{>}, "$file.new")
+ or die "$0: cannot create $file.new: $!\n";
SCAN:
while (defined(my $line = <$in>)) {
if ( $line =~ s{ $REGEX_VERSION_PACKAGE }{$1$version$3}xms
- || $line =~ s{ $REGEX_VERSION_OLD }{$1$version$3}xms)
+ || $line =~ s{ $REGEX_VERSION_OLD }{$1$old_version$3}xms)
{
print {$out} $line or die "$0: cannot write to $file.new: $!\n";
last SCAN;
@@ -153,8 +151,8 @@ sub _update_module_version {
# Copy the rest of the input file to the output file.
print {$out} <$in> or die "$0: cannot write to $file.new: $!\n";
- close($out) or die "$0: cannot flush $file.new: $!\n";
- close($in) or die "$0: error reading from $file: $!\n";
+ close($out) or die "$0: cannot flush $file.new: $!\n";
+ close($in) or die "$0: error reading from $file: $!\n";
# All done. Rename the new file over top of the old file.
rename("$file.new", $file)
@@ -267,7 +265,7 @@ Russ Allbery <eagle@eyrie.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2016 Russ Allbery <eagle@eyrie.org>
+Copyright 2016, 2018-2019 Russ Allbery <eagle@eyrie.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/man/devise-date.t b/gnu/usr.bin/perl/cpan/podlators/t/man/devise-date.t
index 129721323c6..4729e0bf0f5 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/man/devise-date.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/man/devise-date.t
@@ -3,16 +3,16 @@
# 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. It also tests special handling of the POD_MAN_DATE
-# environment variable.
+# and SOURCE_DATE_EPOCH environment variables.
#
-# Copyright 2009, 2014-2015, 2018 Russ Allbery <rra@cpan.org>
+# Copyright 2009, 2014-2015, 2018-2019 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/man/devise-title.t b/gnu/usr.bin/perl/cpan/podlators/t/man/devise-title.t
index a7e5e7b89d2..b2e82468b47 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/man/devise-title.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/man/devise-title.t
@@ -3,14 +3,14 @@
# Tests for the automatic determination of the manual page title if not
# specified via options to pod2man or the Pod::Man constructor.
#
-# Copyright 2015-2016, 2018 Russ Allbery <rra@cpan.org>
+# Copyright 2015-2016, 2018-2019 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/man/empty.t b/gnu/usr.bin/perl/cpan/podlators/t/man/empty.t
index 4924fc8466a..cd0cfccc37d 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/man/empty.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/man/empty.t
@@ -2,14 +2,14 @@
#
# Test Pod::Man with a document that produces only errors.
#
-# Copyright 2013, 2016, 2018 Russ Allbery <rra@cpan.org>
+# Copyright 2013, 2016, 2018-2019 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/man/heading.t b/gnu/usr.bin/perl/cpan/podlators/t/man/heading.t
index 9691446b6f6..f8964025e3f 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/man/heading.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/man/heading.t
@@ -2,7 +2,7 @@
#
# Additional tests for Pod::Man heading generation.
#
-# Copyright 2002, 2004, 2006, 2008-2009, 2012, 2015, 2018
+# Copyright 2002, 2004, 2006, 2008-2009, 2012, 2015, 2018-2019
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
@@ -10,7 +10,7 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/man/no-encode.t b/gnu/usr.bin/perl/cpan/podlators/t/man/no-encode.t
index 15522a5d96a..199016217d2 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/man/no-encode.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/man/no-encode.t
@@ -3,22 +3,25 @@
# Test for graceful degradation to non-utf8 output without Encode module.
#
# Copyright 2016 Niko Tyni <ntyni@iki.fi>
-# Copyright 2016, 2018 Russ Allbery <rra@cpan.org>
+# Copyright 2016, 2018-2019 Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 5;
-# Force the Encode module to be impossible to import.
+# Remove the record of the Encode module being loaded if it already was (it
+# may have been loaded before the test suite runs), and then make it
+# impossible to load it. This should be enough to trigger the fallback code
+# in Pod::Man.
BEGIN {
- ok(!$INC{'Encode.pm'}, 'Encode is not loaded yet');
+ delete $INC{'Encode.pm'};
my $reject_encode = sub {
if ($_[1] eq 'Encode.pm') {
die "refusing to load Encode\n";
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/man/utf8-io.t b/gnu/usr.bin/perl/cpan/podlators/t/man/utf8-io.t
index d1c950076b3..76e21b98f04 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/man/utf8-io.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/man/utf8-io.t
@@ -1,8 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# Test Pod::Man UTF-8 handling, with and without PerlIO.
#
-# Copyright 2002, 2004, 2006, 2008-2010, 2012, 2014-2015, 2018
+# Copyright 2002, 2004, 2006, 2008-2010, 2012, 2014-2015, 2018-2020
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
@@ -10,24 +10,15 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
-use Test::More;
+use Test::More tests => 13;
use Test::Podlators qw(test_snippet_with_io);
-# 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 => 13;
- }
-}
-
# Load the module.
BEGIN {
use_ok('Pod::Man');
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/parselink/basic.t b/gnu/usr.bin/perl/cpan/podlators/t/parselink/basic.t
index 48fbb37f137..0f39e563976 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/parselink/basic.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/parselink/basic.t
@@ -1,122 +1,120 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
-# parselink.t -- Tests for Pod::ParseLink.
+# Tests for Pod::ParseLink.
#
-# Copyright 2001, 2009, 2018 by Russ Allbery <rra@cpan.org>
+# Copyright 2001, 2009, 2018, 2020 by Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-# The format of each entry in this array is the L<> text followed by the
-# five-element parse returned by parselink.
-our @TESTS = (
- [ 'foo',
- undef, 'foo', 'foo', undef, 'pod' ],
-
- [ 'foo|bar',
- 'foo', 'foo', 'bar', undef, 'pod' ],
-
- [ 'foo/bar',
- undef, '"bar" in foo', 'foo', 'bar', 'pod' ],
-
- [ 'foo/"baz boo"',
- undef, '"baz boo" in foo', 'foo', 'baz boo', 'pod' ],
-
- [ '/bar',
- undef, '"bar"', undef, 'bar', 'pod' ],
-
- [ '/"baz boo"',
- undef, '"baz boo"', undef, 'baz boo', 'pod' ],
-
- [ '/baz boo',
- undef, '"baz boo"', undef, 'baz boo', 'pod' ],
-
- [ 'foo bar/baz boo',
- undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod' ],
-
- [ 'foo bar / baz boo',
- undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod' ],
-
- [ "foo\nbar\nbaz\n/\nboo",
- undef, '"boo" in foo bar baz', 'foo bar baz', 'boo', 'pod' ],
-
- [ 'anchor|name/section',
- 'anchor', 'anchor', 'name', 'section', 'pod' ],
-
- [ '"boo var baz"',
- undef, '"boo var baz"', undef, 'boo var baz', 'pod' ],
-
- [ 'bar baz',
- undef, '"bar baz"', undef, 'bar baz', 'pod' ],
-
- [ '"boo bar baz / baz boo"',
- undef, '"boo bar baz / baz boo"', undef, 'boo bar baz / baz boo',
- 'pod' ],
-
- [ 'fooZ<>bar',
- undef, 'fooZ<>bar', 'fooZ<>bar', undef, 'pod' ],
-
- [ 'Testing I<italics>|foo/bar',
- 'Testing I<italics>', 'Testing I<italics>', 'foo', 'bar', 'pod' ],
-
- [ 'foo/I<Italic> text',
- undef, '"I<Italic> text" in foo', 'foo', 'I<Italic> text', 'pod' ],
-
- [ 'fooE<verbar>barZ<>/Section C<with> I<B<other> markup',
- undef, '"Section C<with> I<B<other> markup" in fooE<verbar>barZ<>',
- 'fooE<verbar>barZ<>', 'Section C<with> I<B<other> markup', 'pod' ],
-
- [ 'Nested L<http://www.perl.org/>|fooE<sol>bar',
- 'Nested L<http://www.perl.org/>', 'Nested L<http://www.perl.org/>',
- 'fooE<sol>bar', undef, 'pod' ],
-
- [ 'ls(1)',
- undef, 'ls(1)', 'ls(1)', undef, 'man' ],
-
- [ ' perlfunc(1)/open ',
- undef, '"open" in perlfunc(1)', 'perlfunc(1)', 'open', 'man' ],
-
- [ 'some manual page|perl(1)',
- 'some manual page', 'some manual page', 'perl(1)', undef, 'man' ],
-
- [ 'http://www.perl.org/',
- undef, 'http://www.perl.org/', 'http://www.perl.org/', undef, 'url' ],
-
- [ 'news:yld72axzc8.fsf@windlord.stanford.edu',
- undef, 'news:yld72axzc8.fsf@windlord.stanford.edu',
- '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' ],
+use 5.008;
+use strict;
+use warnings;
- [ '0|Pod::Parser',
- '0', '0', 'Pod::Parser', undef, 'pod' ],
-);
+use Test::More tests => 28;
BEGIN {
- chdir 't' if -d 't';
- unshift (@INC, '../blib/lib');
- $| = 1;
+ use_ok('Pod::ParseLink');
}
-use strict;
-
-use Test::More tests => 28;
-BEGIN { use_ok ('Pod::ParseLink') }
-
-# Used for reporting test failures.
-my @names = qw(text inferred name section type);
+# The format of each entry in this array is the L<> text followed by the
+# five-element parse returned by parselink.
+our @TESTS = (
+ ['foo' => (undef, 'foo', 'foo', undef, 'pod')],
+ ['foo|bar' => ('foo', 'foo', 'bar', undef, 'pod')],
+ ['foo/bar' => (undef, '"bar" in foo', 'foo', 'bar', 'pod')],
+ ['foo/"baz boo"' => (undef, '"baz boo" in foo', 'foo', 'baz boo', 'pod')],
+ ['/bar' => (undef, '"bar"', undef, 'bar', 'pod')],
+ ['/"baz boo"' => (undef, '"baz boo"', undef, 'baz boo', 'pod')],
+ ['/baz boo', => (undef, '"baz boo"', undef, 'baz boo', 'pod')],
+ [
+ 'foo bar/baz boo' =>
+ (undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod')
+ ],
+ [
+ 'foo bar / baz boo' =>
+ (undef, '"baz boo" in foo bar', 'foo bar', 'baz boo', 'pod')
+ ],
+ [
+ "foo\nbar\nbaz\n/\nboo" =>
+ (undef, '"boo" in foo bar baz', 'foo bar baz', 'boo', 'pod')
+ ],
+ ['anchor|name/section' => qw(anchor anchor name section pod)],
+ ['"boo var baz"' => (undef, '"boo var baz"', undef, 'boo var baz', 'pod')],
+ ['bar baz' => (undef, '"bar baz"', undef, 'bar baz', 'pod')],
+ [
+ '"boo bar baz / baz boo"' => (
+ undef, '"boo bar baz / baz boo"',
+ undef, 'boo bar baz / baz boo',
+ 'pod',
+ )
+ ],
+ ['fooZ<>bar' => (undef, 'fooZ<>bar', 'fooZ<>bar', undef, 'pod')],
+ [
+ 'Testing I<italics>|foo/bar' =>
+ ('Testing I<italics>', 'Testing I<italics>', 'foo', 'bar', 'pod')
+ ],
+ [
+ 'foo/I<Italic> text' =>
+ (undef, '"I<Italic> text" in foo', 'foo', 'I<Italic> text', 'pod')
+ ],
+ [
+ 'fooE<verbar>barZ<>/Section C<with> I<B<other> markup' => (
+ undef,
+ '"Section C<with> I<B<other> markup" in fooE<verbar>barZ<>',
+ 'fooE<verbar>barZ<>',
+ 'Section C<with> I<B<other> markup',
+ 'pod',
+ )
+ ],
+ [
+ 'Nested L<http://www.perl.org/>|fooE<sol>bar' => (
+ 'Nested L<http://www.perl.org/>',
+ 'Nested L<http://www.perl.org/>',
+ 'fooE<sol>bar', undef, 'pod',
+ )
+ ],
+ ['ls(1)' => (undef, 'ls(1)', 'ls(1)', undef, 'man')],
+ [
+ ' perlfunc(1)/open ' =>
+ (undef, '"open" in perlfunc(1)', 'perlfunc(1)', 'open', 'man')
+ ],
+ [
+ 'some manual page|perl(1)' =>
+ ('some manual page', 'some manual page', 'perl(1)', undef, 'man')
+ ],
+ [
+ 'http://www.perl.org/' => (
+ undef, 'http://www.perl.org/', 'http://www.perl.org/', undef,
+ 'url',
+ )
+ ],
+ [
+ 'news:yld72axzc8.fsf@windlord.stanford.edu' => (
+ undef,
+ 'news:yld72axzc8.fsf@windlord.stanford.edu',
+ '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')],
+);
-for (@TESTS) {
- my @expected = @$_;
- my $link = shift @expected;
- my @results = parselink ($link);
- my $pretty = $link;
- $pretty =~ s/\n/\\n/g;
- is_deeply (\@results, \@expected, $pretty);
+# Run all of the tests.
+for my $test (@TESTS) {
+ my ($link, @expected) = @$test;
+ my @results = parselink($link);
+ my $pretty = $link;
+ $pretty =~ s{\n}{\\n}xmsg;
+ is_deeply(\@results, \@expected, $pretty);
}
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/style/minimum-version.t b/gnu/usr.bin/perl/cpan/podlators/t/style/minimum-version.t
index 7698c2babf1..861367de4ae 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/style/minimum-version.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/style/minimum-version.t
@@ -6,6 +6,7 @@
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2019 Russ Allbery <eagle@eyrie.org>
# Copyright 2013-2014
# The Board of Trustees of the Leland Stanford Junior University
#
@@ -29,16 +30,17 @@
#
# SPDX-License-Identifier: MIT
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
-use Test::More;
use Test::RRA qw(skip_unless_automated use_prereq);
use Test::RRA::Config qw($MINIMUM_VERSION);
+use Test::More;
+
# Skip for normal user installs since this doesn't affect functionality.
skip_unless_automated('Minimum version tests');
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/style/module-version.t b/gnu/usr.bin/perl/cpan/podlators/t/style/module-version.t
index 80368cb02e1..035b596de51 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/style/module-version.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/style/module-version.t
@@ -11,16 +11,17 @@
#
# SPDX-License-Identifier: MIT
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
-use Getopt::Long qw(GetOptions);
use Test::RRA qw(skip_unless_automated use_prereq);
use Test::RRA::ModuleVersion qw(test_module_versions update_module_versions);
+use Getopt::Long qw(GetOptions);
+
# If we have options, we're being run from the command line and always load
# our prerequisite modules. Otherwise, check if we have necessary
# prerequisites and should run as a test suite.
@@ -120,7 +121,7 @@ Russ Allbery <eagle@eyrie.org>
=head1 COPYRIGHT AND LICENSE
-Copyright 2014-2016 Russ Allbery <eagle@eyrie.org>
+Copyright 2014-2016, 2019 Russ Allbery <eagle@eyrie.org>
Copyright 2013-2014 The Board of Trustees of the Leland Stanford Junior
University
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/style/strict.t b/gnu/usr.bin/perl/cpan/podlators/t/style/strict.t
index a3d2a3e942c..a87c1fabca1 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/style/strict.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/style/strict.t
@@ -6,7 +6,7 @@
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
-# Copyright 2016 Russ Allbery <eagle@eyrie.org>
+# Copyright 2016, 2018-2019 Russ Allbery <eagle@eyrie.org>
# Copyright 2013-2014
# The Board of Trustees of the Leland Stanford Junior University
#
@@ -30,15 +30,16 @@
#
# SPDX-License-Identifier: MIT
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
-use File::Spec;
use Test::RRA qw(skip_unless_automated use_prereq);
+use File::Spec;
+
# Skip for normal user installs since this doesn't affect functionality.
skip_unless_automated('Strictness tests');
@@ -46,15 +47,40 @@ skip_unless_automated('Strictness tests');
# use 5.012 or later automatically implies use strict.
use_prereq('Test::Strict', '0.25');
-# Test everything in the distribution directory except the Build and
-# Makefile.PL scripts generated by Module::Build. We also want to check use
-# warnings.
-$Test::Strict::TEST_SKIP = ['Build', 'Makefile.PL'];
+# Directories to exclude from checks.
+my %EXCLUDE = map { $_ => 1 } qw(.git blib);
+
+# Determine whether we want to check the given file or top-level directory.
+# Assume that the only interesting files at the top level are directories or
+# files ending in *.PL.
+#
+# $file - Name of the file or directory
+#
+# Returns: 1 if it should be checked, undef otherwise.
+sub should_check {
+ my ($file) = @_;
+ return if $EXCLUDE{$file};
+ return 1 if -d $file;
+ return 1 if $file =~ m{ [.] PL \z }xms;
+ return;
+}
+
+# Test::Strict (as of 0.47) doesn't have a way of excluding whole directories
+# from all_perl_files_ok and doesn't exclude .git, which results in false
+# positives if there are Perl files unpacked under .git (which is often the
+# case when using dgit). We therefore can't just point it at the root of the
+# module distribution and instead have to manually construct a list of
+# interesting files.
+opendir(my $rootdir, File::Spec->curdir)
+ or die "$0: cannot open current directory: $!\n";
+my @files = File::Spec->no_upwards(readdir($rootdir));
+closedir($rootdir) or die "$0: cannot close current directory: $!\n";
+my @to_check = grep { should_check($_) } @files;
+
+# Test the files and top-level directories we found, including checking for
+# use warnings.
$Test::Strict::TEST_WARNINGS = 1;
-all_perl_files_ok(File::Spec->curdir);
+all_perl_files_ok(@to_check);
# Hack to suppress "used only once" warnings.
-END {
- $Test::Strict::TEST_SKIP = [];
- $Test::Strict::TEST_WARNINGS = 0;
-}
+END { $Test::Strict::TEST_WARNINGS = 0 }
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/basic.t b/gnu/usr.bin/perl/cpan/podlators/t/text/basic.t
deleted file mode 100644
index 024cc0e0e7f..00000000000
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/basic.t
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Additional specialized tests for Pod::Text.
-#
-# Copyright 2002, 2004, 2006-2009, 2012, 2018
-# Russ Allbery <rra@cpan.org>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
-# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-
-BEGIN {
- chdir 't' if -d 't';
- if ($ENV{PERL_CORE}) {
- @INC = '../lib';
- }
- unshift (@INC, '../blib/lib');
- $| = 1;
-}
-
-use strict;
-
-use Pod::Simple;
-use Test::More tests => 9;
-BEGIN { use_ok ('Pod::Text') }
-
-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";
- 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 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 PERIODS
-
-This C<.> should be quoted.
-###
-PERIODS
- This "." should be quoted.
-
-###
-
-###
-=head1 CE<lt>E<gt> WITH SPACES
-
-What does C<< this. >> end up looking like?
-###
-C<> WITH SPACES
- What does "this." end up looking like?
-
-###
-
-###
-=head1 Test of SE<lt>E<gt>
-
-This is some S< > whitespace.
-###
-Test of S<>
- This is some whitespace.
-
-###
-
-###
-=head1 Test of =for
-
-=for comment
-This won't be seen.
-
-Yes.
-
-=for text
-This should be seen.
-
-=for TEXT As should this.
-
-=for man
-But this shouldn't.
-
-Some more text.
-###
-Test of =for
- Yes.
-
-This should be seen.
-As should this.
- Some more text.
-
-###
-
-###
-=pod
-
-text
-
- line1
-
- line3
-###
- text
-
- line1
-
- 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.
-
-###
-
-###
-=head1 RT LINK
-
-L<[perl #12345]|https://rt.cpan.org/12345>
-###
-RT LINK
- [perl #12345] <https://rt.cpan.org/12345>
-
-###
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/color.t b/gnu/usr.bin/perl/cpan/podlators/t/text/color.t
index b7edd48a27b..aa75beeb057 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/color.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/text/color.t
@@ -2,13 +2,13 @@
#
# Test Pod::Text::Color behavior with various snippets.
#
-# Copyright 2002, 2004, 2006, 2009, 2012-2013, 2018
+# Copyright 2002, 2004, 2006, 2009, 2012-2013, 2018-2019
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
-use 5.006;
+use 5.008;
use strict;
use warnings;
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/empty.t b/gnu/usr.bin/perl/cpan/podlators/t/text/empty.t
deleted file mode 100644
index e03a03c4a38..00000000000
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/empty.t
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Test Pod::Text with a document that produces only errors.
-#
-# Copyright 2013, 2018 Russ Allbery <rra@cpan.org>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
-# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-
-BEGIN {
- chdir 't' if -d 't';
- if ($ENV{PERL_CORE}) {
- @INC = '../lib';
- }
- unshift (@INC, '../blib/lib');
- $| = 1;
-}
-
-use strict;
-
-use Test::More tests => 8;
-BEGIN { use_ok ('Pod::Text') }
-
-# Set up Pod::Text to output to a string.
-my $parser = Pod::Text->new;
-isa_ok ($parser, 'Pod::Text');
-my $output;
-$parser->output_string (\$output);
-
-# Try a POD document where the only command is invalid. Be sure that we don't
-# get any warnings as well as any errors.
-local $SIG{__WARN__} = sub { die $_[0] };
-ok (eval { $parser->parse_string_document("=\xa0") },
- 'Parsed invalid document');
-is ($@, '', '...with no errors');
-SKIP: {
- skip 'Pod::Simple does not produce errors for invalid commands', 1
- if $output eq q{};
- like ($output, qr{POD ERRORS},
- '...and output contains a POD ERRORS section');
-}
-
-# Try with a document containing only =cut.
-ok (eval { $parser->parse_string_document("=cut") },
- 'Parsed invalid document');
-is ($@, '', '...with no errors');
-SKIP: {
- skip 'Pod::Simple does not produce errors for invalid commands', 1
- if $output eq q{};
- like ($output, qr{POD ERRORS},
- '...and output contains a POD ERRORS section');
-}
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/encoding.t b/gnu/usr.bin/perl/cpan/podlators/t/text/encoding.t
deleted file mode 100644
index 7a6b6f2801b..00000000000
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/encoding.t
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Test Pod::Text with various weird encoding combinations.
-#
-# Copyright 2002, 2004, 2006-2009, 2012, 2015, 2018
-# Russ Allbery <rra@cpan.org>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
-# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-
-BEGIN {
- chdir 't' if -d 't';
- if ($ENV{PERL_CORE}) {
- @INC = '../lib';
- }
- unshift (@INC, '../blib/lib');
- $| = 1;
-}
-
-use strict;
-
-use Test::More;
-
-# 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') }
-
-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;
- 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>) {
- last if $_ eq "###\n";
- print TMP $_;
- }
- close TMP;
- open (OUT, "> out$$.tmp") or die "Cannot create out$$.tmp: $!\n";
- eval { binmode (\*OUT, ':raw') };
- $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;
- 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 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>
-
-###
-
-###
-=pod
-
-=head1 NAME
-
-This is the first ascii text
-
-=encoding utf8
-
-=over 4
-
-=item ⇒This is the first non-ascii text⇐
-
-This is the second ascii text
-
-=back
-
-=cut
-###
-NAME
- This is the first ascii text
-
- ⇒This is the first non-ascii text⇐
- This is the second ascii text
-
-###
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/options.t b/gnu/usr.bin/perl/cpan/podlators/t/text/options.t
deleted file mode 100644
index d191cf00f97..00000000000
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/options.t
+++ /dev/null
@@ -1,368 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Additional tests for Pod::Text options.
-#
-# Copyright 2002, 2004, 2006, 2008-2009, 2012-2013, 2015, 2018
-# Russ Allbery <rra@cpan.org>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
-# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-
-BEGIN {
- chdir 't' if -d 't';
- if ($ENV{PERL_CORE}) {
- @INC = '../lib';
- }
- unshift (@INC, '../blib/lib');
- $| = 1;
-}
-
-use strict;
-
-use Test::More tests => 37;
-BEGIN { use_ok ('Pod::Text') }
-
-# Redirect stderr to a file.
-sub stderr_save {
- open (OLDERR, '>&STDERR') or die "Can't dup STDERR: $!\n";
- open (STDERR, "> out$$.err") or die "Can't redirect STDERR: $!\n";
-}
-
-# Restore stderr.
-sub stderr_restore {
- close STDERR;
- open (STDERR, '>&OLDERR') or die "Can't dup STDERR: $!\n";
- close OLDERR;
-}
-
-my $n = 1;
-while (<DATA>) {
- my %options;
- next until $_ eq "###\n";
- while (<DATA>) {
- last if $_ eq "###\n";
- my ($option, $value) = split;
- $options{$option} = $value;
- }
- open (TMP, "> tmp$$.pod") or die "Cannot create tmp$$.pod: $!\n";
- while (<DATA>) {
- last if $_ eq "###\n";
- print TMP $_;
- }
- close TMP;
- 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;
- eval { $parser->parse_from_file ("tmp$$.pod", \*OUT) };
- my $exception = $@;
- stderr_restore;
- 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");
- open (ERR, "out$$.err") or die "Cannot open out$$.err: $!\n";
- my $errors;
- {
- local $/;
- $errors = <ERR>;
- }
- close ERR;
- $errors =~ s/\Qtmp$$.pod/tmp.pod/g;
- 1 while unlink ("out$$.err");
- if ($exception) {
- $exception =~ s/ at .*//;
- $errors .= "EXCEPTION: $exception";
- }
- $expected = '';
- while (<DATA>) {
- last if $_ eq "###\n";
- $expected .= $_;
- }
- 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
-# options, input, output, and errors are separated by lines containing only
-# ###.
-
-__DATA__
-
-###
-alt 1
-###
-=head1 SAMPLE
-
-=over 4
-
-=item F
-
-Paragraph.
-
-=item Bar
-
-=item B
-
-Paragraph.
-
-=item Longer
-
-Paragraph.
-
-=back
-
-###
-
-==== SAMPLE ====
-
-: F Paragraph.
-
-: Bar
-: B Paragraph.
-
-: Longer
- Paragraph.
-
-###
-###
-
-###
-margin 4
-###
-=head1 SAMPLE
-
-This is some body text that is long enough to be a paragraph that wraps,
-thereby testing margins with wrapped paragraphs.
-
- This is some verbatim text.
-
-=over 6
-
-=item Test
-
-This is a test of an indented paragraph.
-
-This is another indented paragraph.
-
-=back
-###
- SAMPLE
- This is some body text that is long enough to be a paragraph that
- wraps, thereby testing margins with wrapped paragraphs.
-
- This is some verbatim text.
-
- Test This is a test of an indented paragraph.
-
- This is another indented paragraph.
-
-###
-###
-
-###
-code 1
-###
-This is some random text.
-This is more random text.
-
-This is some random text.
-This is more random text.
-
-=head1 SAMPLE
-
-This is POD.
-
-=cut
-
-This is more random text.
-###
-This is some random text.
-This is more random text.
-
-This is some random text.
-This is more random text.
-
-SAMPLE
- This is POD.
-
-
-This is more random text.
-###
-###
-
-###
-sentence 1
-###
-=head1 EXAMPLE
-
-Whitespace around C<< this. >> must be ignored per perlpodspec. >>
-needs to eat all of the space in front of it.
-
-=cut
-###
-EXAMPLE
- Whitespace around "this." must be ignored per perlpodspec. >> needs to
- eat all of the space in front of it.
-
-###
-###
-
-###
-###
-=over 4
-
-=item Foo
-
-Bar.
-
-=head1 NEXT
-###
- Foo Bar.
-
-NEXT
-POD ERRORS
- Hey! The above document had some coding errors, which are explained
- below:
-
- Around line 7:
- You forgot a '=back' before '=head1'
-
-###
-###
-
-###
-stderr 1
-###
-=over 4
-
-=item Foo
-
-Bar.
-
-=head1 NEXT
-###
- Foo Bar.
-
-NEXT
-###
-tmp.pod around line 7: You forgot a '=back' before '=head1'
-###
-
-###
-nourls 1
-###
-=head1 URL suppression
-
-L<anchor|http://www.example.com/>
-###
-URL suppression
- anchor
-
-###
-###
-
-###
-errors stderr
-###
-=over 4
-
-=item Foo
-
-Bar.
-
-=head1 NEXT
-###
- Foo Bar.
-
-NEXT
-###
-tmp.pod around line 7: You forgot a '=back' before '=head1'
-###
-
-###
-errors die
-###
-=over 4
-
-=item Foo
-
-Bar.
-
-=head1 NEXT
-###
- Foo Bar.
-
-NEXT
-###
-tmp.pod around line 7: You forgot a '=back' before '=head1'
-EXCEPTION: POD document had syntax errors
-###
-
-###
-errors pod
-###
-=over 4
-
-=item Foo
-
-Bar.
-
-=head1 NEXT
-###
- Foo Bar.
-
-NEXT
-POD ERRORS
- Hey! The above document had some coding errors, which are explained
- below:
-
- Around line 7:
- You forgot a '=back' before '=head1'
-
-###
-###
-
-###
-errors none
-###
-=over 4
-
-=item Foo
-
-Bar.
-
-=head1 NEXT
-###
- Foo Bar.
-
-NEXT
-###
-###
-
-###
-quotes <<<>>>
-###
-=head1 FOO C<BAR> BAZ
-
-Foo C<bar> baz.
-###
-FOO <<<BAR>>> BAZ
- Foo <<<bar>>> baz.
-
-###
-###
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/overstrike.t b/gnu/usr.bin/perl/cpan/podlators/t/text/overstrike.t
index 7433264cb3c..7cdaa538b2d 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/overstrike.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/text/overstrike.t
@@ -1,8 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
-# Additional specialized tests for Pod::Text::Overstrike.
+# Test Pod::Text::Overstrike with various snippets.
#
-# Copyright 2002, 2004, 2006, 2009, 2012-2013, 2018
+# Copyright 2002, 2004, 2006, 2009, 2012-2013, 2018-2019
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
@@ -10,97 +10,23 @@
#
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-BEGIN {
- chdir 't' if -d 't';
- if ($ENV{PERL_CORE}) {
- @INC = '../lib';
- }
- unshift (@INC, '../blib/lib');
- $| = 1;
-}
-
+use 5.008;
use strict;
+use warnings;
-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
+use lib 't/lib';
-=item 12345678
+use Test::More tests => 5;
+use Test::Podlators qw(test_snippet);
-A
-
-=item B<12345678>
-
-B
-
-=item 1Z<>
-
-C
-
-=item B<1>
-
-D
-
-=back
-###
-TTAAGG  WWIIDDTTHH
- 12345678 A
-
- 1122334455667788 B
-
- 1 C
+BEGIN {
+ use_ok('Pod::Text::Overstrike');
+}
- 11 D
+# List of snippets run by this test.
+my @snippets = qw(tag-width wrapping);
-###
+# Run all the tests.
+for my $snippet (@snippets) {
+ test_snippet('Pod::Text::Overstrike', "overstrike/$snippet");
+}
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/perlio.t b/gnu/usr.bin/perl/cpan/podlators/t/text/perlio.t
deleted file mode 100644
index 1b6523d328a..00000000000
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/perlio.t
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Test Pod::Text with a PerlIO UTF-8 encoding layer.
-#
-# Copyright 2002, 2004, 2006-2010, 2012, 2014, 2018
-# Russ Allbery <rra@cpan.org>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
-# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-
-BEGIN {
- chdir 't' if -d 't';
- if ($ENV{PERL_CORE}) {
- @INC = '../lib';
- }
- unshift (@INC, '../blib/lib');
- $| = 1;
-}
-
-use strict;
-
-use Test::More;
-
-# 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') }
-
-# Force UTF-8 on all relevant file handles. Hide this in a string eval so
-# that older versions of Perl don't croak and minimum-version tests still
-# pass.
-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 $parser = Pod::Text->new (utf8 => 1);
-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";
- eval 'binmode (\*TMP, ":encoding(utf-8)")';
- print TMP "=encoding UTF-8\n\n";
- while (<DATA>) {
- last if $_ eq "###\n";
- print TMP $_;
- }
- 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";
- eval 'binmode (\*TMP, ":encoding(utf-8)")';
- 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 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.
-
-###
-
-###
-=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>
-
-###
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/termcap.t b/gnu/usr.bin/perl/cpan/podlators/t/text/termcap.t
index 4a9893a9daa..598e0b56203 100644
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/termcap.t
+++ b/gnu/usr.bin/perl/cpan/podlators/t/text/termcap.t
@@ -2,19 +2,21 @@
#
# Test Pod::Text::Termcap behavior with various snippets.
#
-# Copyright 2002, 2004, 2006, 2009, 2012-2014, 2018
+# Copyright 2002, 2004, 2006, 2009, 2012-2014, 2018-2019
# Russ Allbery <rra@cpan.org>
#
# This program is free software; you may redistribute it and/or modify it
# under the same terms as Perl itself.
+#
+# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-use 5.006;
+use 5.008;
use strict;
use warnings;
use lib 't/lib';
-use Test::More tests => 11;
+use Test::More tests => 15;
use Test::Podlators qw(test_snippet);
# Load the module.
@@ -28,6 +30,10 @@ $ENV{TERM} = 'xterm';
$ENV{TERMPATH} = File::Spec->catfile('t', 'data', 'termcap');
$ENV{TERMCAP} = 'xterm:co=#80:do=^J:md=\E[1m:us=\E[4m:me=\E[m';
+# Check the regex that matches a single formatting character.
+my $parser = Pod::Text::Termcap->new();
+is($parser->format_regex(), "\\\e\\[1m|\\\e\\[4m|\\\e\\[m", 'Character regex');
+
# List of snippets run by this test.
my @snippets = qw(escape-wrapping tag-width tag-wrapping width wrapping);
@@ -35,3 +41,15 @@ my @snippets = qw(escape-wrapping tag-width tag-wrapping width wrapping);
for my $snippet (@snippets) {
test_snippet('Pod::Text::Termcap', "termcap/$snippet");
}
+
+# Now test with an unknown terminal type.
+$ENV{TERM} = 'unknown';
+$ENV{TERMCAP} = 'unknown:co=#80:do=^J';
+test_snippet('Pod::Text::Termcap', 'termcap/term-unknown');
+
+# Test the character regex with a fake terminal type that only provides bold
+# and normal, not underline.
+$ENV{TERM} = 'fake-test-terminal';
+$ENV{TERMCAP} = 'fake-test-terminal:md=\E[1m:me=\E[m';
+$parser = Pod::Text::Termcap->new();
+is($parser->format_regex(), "\\\e\\[1m|\\\e\\[m", 'Limited character regex');
diff --git a/gnu/usr.bin/perl/cpan/podlators/t/text/utf8.t b/gnu/usr.bin/perl/cpan/podlators/t/text/utf8.t
deleted file mode 100644
index a04010ea101..00000000000
--- a/gnu/usr.bin/perl/cpan/podlators/t/text/utf8.t
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Test Pod::Text with UTF-8 input.
-#
-# Copyright 2002, 2004, 2006-2009, 2012, 2014, 2018
-# Russ Allbery <rra@cpan.org>
-#
-# This program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-#
-# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
-
-BEGIN {
- chdir 't' if -d 't';
- if ($ENV{PERL_CORE}) {
- @INC = '../lib';
- }
- unshift (@INC, '../blib/lib');
- $| = 1;
-}
-
-use strict;
-
-use Test::More;
-
-# 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') }
-
-# Force UTF-8 on all relevant file handles. Hide this in a string eval so
-# that older versions of Perl don't croak and minimum-version tests still
-# pass.
-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 $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";
- eval 'binmode (\*TMP, ":encoding(utf-8)")';
- print TMP "=encoding UTF-8\n\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";
- eval 'binmode (\*TMP, ":encoding(utf-8)")';
- 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 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.
-
-###
-
-###
-=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>
-
-###