From: Steve Hancock Date: Mon, 24 Aug 2020 13:58:01 +0000 (-0700) Subject: added revised test for RT #133161, check for pod2html X-Git-Tag: 20200907~40 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7244224b2189fbc9596e72057472f50796e8fc39;p=perltidy.git added revised test for RT #133161, check for pod2html --- diff --git a/t/test-pod2html.t b/t/test-pod2html.t new file mode 100644 index 00000000..a287a07b --- /dev/null +++ b/t/test-pod2html.t @@ -0,0 +1,75 @@ +use strict; +use Test::More; +use Carp; +use Perl::Tidy; +BEGIN { plan tests => 1 } + +# Check that pod2html is working. +# Added to check for issue RT #133161, in which pod2html +# was not getting called. + +my $source = <<'----------'; +=head1 APPENDIX + +The rest of the documentation details each of the object +methods. Internal methods are usually preceded with a _ + +=cut + +# Let the code begin... + +package Astro::Circus; +use vars qw(@ISA); +use strict; +---------- + +my $output; +my $params = '-html'; +my $stderr_string; +my $errorfile_string; +my $err = Perl::Tidy::perltidy( + source => \$source, + destination => \$output, + perltidyrc => \$params, + argv => '', # for safety; hide any ARGV from perltidy + stderr => \$stderr_string, + errorfile => \$errorfile_string, # not used when -se flag is set +); +if ( $err || $stderr_string || $errorfile_string || !$output ) { + print STDERR "Error output received\n"; + if ($err) { + print STDERR "An error flag '$err' was returned\n"; + ok( !$err ); + } + if ($stderr_string) { + print STDERR "---------------------\n"; + print STDERR "<>\n$stderr_string\n"; + print STDERR "---------------------\n"; + ok( !$stderr_string ); + } + if ($errorfile_string) { + print STDERR "---------------------\n"; + print STDERR "<<.ERR file>>\n$errorfile_string\n"; + print STDERR "---------------------\n"; + ok( !$errorfile_string ); + } + if ( !$output ) { + print STDERR "---------------------\n"; + print STDERR "No output produced\n"; + print STDERR "---------------------\n"; + ok($output); + } +} +else { + + # The html header content can vary with system, so we will + # just make sure the output looks like html + if ( $output =~ /<\/html>\s*$/ ) { + ok( 1, "looks like html" ); + } + else { + print STDERR "---------------------\n"; + print STDERR "output does not seem to be html\n"; + print STDERR "---------------------\n"; + } +}