X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fpod%2Ftestp2pt.pl;h=4d99f82a72e829d0d6689682d7ee702dd237cb5f;hb=d8f6a7325d6b2ec46e8cdc1ec4b5e1ad4a86abd0;hp=9df5b9f2ed42ee8a9b3949204ff015ff5244e20a;hpb=e9fdc7d2ad34e80787f760dcc04e2f23a1599092;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/pod/testp2pt.pl b/t/pod/testp2pt.pl index 9df5b9f..4d99f82 100644 --- a/t/pod/testp2pt.pl +++ b/t/pod/testp2pt.pl @@ -13,8 +13,6 @@ BEGIN { push @INC, map { File::Spec->catfile($_, 'lib') } ($PARENTDIR, $THISDIR); } -use Pod::PlainText; -use vars qw(@ISA @EXPORT $MYPKG); #use strict; #use diagnostics; use Carp; @@ -22,25 +20,43 @@ use Exporter; #use File::Compare; #use Cwd qw(abs_path); -@ISA = qw(Pod::PlainText); -@EXPORT = qw(&testpodplaintext); +use vars qw($MYPKG @EXPORT @ISA); $MYPKG = eval { (caller)[0] }; +@EXPORT = qw(&testpodplaintext); +BEGIN { + if ( $] >= 5.005_58 ) { + require Pod::Text; + @ISA = qw( Pod::Text ); + } + else { + require Pod::PlainText; + @ISA = qw( Pod::PlainText ); + } + require VMS::Filespec if $^O eq 'VMS'; +} ## Hardcode settings for TERMCAP and COLUMNS so we can try to get ## reproducible results between environments -@ENV{qw(TERMCAP COLUMNS)} = ('co=72:do=^J', 72); +@ENV{qw(TERMCAP COLUMNS)} = ('co=76:do=^J', 76); sub catfile(@) { File::Spec->catfile(@_); } my $INSTDIR = abs_path(dirname $0); -$INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 'xtra'); +if ($^O eq 'VMS') { # clean up directory spec + $INSTDIR = VMS::Filespec::unixpath($INSTDIR); + $INSTDIR =~ s#/$##; + $INSTDIR =~ s#/000000/#/#; +} +# cut 't/pod' from path (cut 't:pod:' on Mac OS) $INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 'pod'); $INSTDIR = (dirname $INSTDIR) if (basename($INSTDIR) eq 't'); + my @PODINCDIRS = ( catfile($INSTDIR, 'lib', 'Pod'), catfile($INSTDIR, 'scripts'), - catfile($INSTDIR, 't', 'pod'), - catfile($INSTDIR, 't', 'pod', 'xtra') + catfile($INSTDIR, 'pod'), + catfile($INSTDIR, 't', 'pod') ); +print "PODINCDIRS = ",join(', ',@PODINCDIRS),"\n"; ## Find the path to the file to =include sub findinclude { @@ -89,10 +105,14 @@ sub command { print $out_fh "###### end =include $incbase #####\n" if ($incdebug); } +sub begin_input { + $_[0]->{_INFILE} = VMS::Filespec::unixify($_[0]->{_INFILE}) if $^O eq 'VMS'; +} + sub podinc2plaintext( $ $ ) { my ($infile, $outfile) = @_; local $_; - my $text_parser = $MYPKG->new; + my $text_parser = $MYPKG->new(quotes => "`'"); $text_parser->parse_from_file($infile, $outfile); } @@ -111,7 +131,7 @@ sub testpodinc2plaintext( @ ) { return $msg; } - print "+ Running testpodinc2plaintext for '$testname'...\n"; + print "# Running testpodinc2plaintext for '$testname'...\n"; ## Compare the output against the expected result podinc2plaintext($infile, $outfile); if ( testcmp($outfile, $cmpfile) ) { @@ -138,19 +158,19 @@ sub testpodplaintext( @ ) { for $podfile (@testpods) { ($testname, $_) = fileparse($podfile); $testdir ||= $_; - $testname =~ s/\.t$//; + $testname =~ s/\..*$//; $cmpfile = $testdir . $testname . '.xr'; $outfile = $testdir . $testname . '.OUT'; if ($opts{'-xrgen'}) { if ($opts{'-force'} or ! -e $cmpfile) { ## Create the comparison file - print "+ Creating expected result for \"$testname\"" . + print "# Creating expected result for \"$testname\"" . " pod2plaintext test ...\n"; podinc2plaintext($podfile, $cmpfile); } else { - print "+ File $cmpfile already exists" . + print "# File $cmpfile already exists" . " (use '-force' to regenerate it).\n"; } next; @@ -162,13 +182,13 @@ sub testpodplaintext( @ ) { -Cmp => $cmpfile; if ($failmsg) { ++$failed; - print "+\tFAILED. ($failmsg)\n"; + print "#\tFAILED. ($failmsg)\n"; print "not ok ", $failed+$passes, "\n"; } else { ++$passes; unlink($outfile); - print "+\tPASSED.\n"; + print "#\tPASSED.\n"; print "ok ", $failed+$passes, "\n"; } }