]> git.donarmstrong.com Git - perltidy.git/commitdiff
added revised test for RT #133161, check for pod2html
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 24 Aug 2020 13:58:01 +0000 (06:58 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 24 Aug 2020 13:58:01 +0000 (06:58 -0700)
t/test-pod2html.t [new file with mode: 0644]

diff --git a/t/test-pod2html.t b/t/test-pod2html.t
new file mode 100644 (file)
index 0000000..a287a07
--- /dev/null
@@ -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 "<<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";
+    }
+}