X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fpod%2Ftestpchk.pl;h=8aa10b94f87c03a2a1583b9db3c039ac5e39541c;hb=d8f6a7325d6b2ec46e8cdc1ec4b5e1ad4a86abd0;hp=cd3c13816db669172607bc553bbdcbdcc2ec58ff;hpb=360aca433d51a01ddd748b8606c6c288bdb2f7fc;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/pod/testpchk.pl b/t/pod/testpchk.pl index cd3c138..8aa10b9 100644 --- a/t/pod/testpchk.pl +++ b/t/pod/testpchk.pl @@ -10,6 +10,7 @@ BEGIN { import TestCompare; my $PARENTDIR = dirname $THISDIR; push @INC, map { File::Spec->catfile($_, 'lib') } ($PARENTDIR, $THISDIR); + require VMS::Filespec if $^O eq 'VMS'; } use Pod::Checker; @@ -33,18 +34,12 @@ sub msgcmp( $ $ ) { ## filter out platform-dependent aspects of error messages my ($line1, $line2) = @_; for ($line1, $line2) { - if ( /^#*\s*(\S.*?)\s+(?:has \d+\s*)?pod syntax (?:error|OK)/ ) { - my $fname = $1; - s/^#*\s*// if ($^O eq 'MacOS'); - s/^\s*\Q$fname\E/stripname($fname)/e; - } - elsif ( /^#*\s*\*+\s*(?:ERROR|Unterminated)/ ) { - s/^#*\s*// if ($^O eq 'MacOS'); - s/of file\s+(\S.*?)\s*$/"of file ".stripname($1)/e; - s/at\s+(\S.*?)\s+line/"at ".stripname($1)." line"/e; - } + ## remove filenames from error messages to avoid any + ## filepath naming differences between OS platforms + s/(at line \S+ in file) .*\W(\w+\.[tT])\s*$/$1 \L$2\E/; + s/.*\W(\w+\.[tT]) (has \d+ pod syntax error)/\L$1\E $2/; } - return $line1 ne $line2; + return ($line1 ne $line2); } sub testpodcheck( @ ) { @@ -62,8 +57,13 @@ sub testpodcheck( @ ) { return $msg; } - print "+ Running podchecker for '$testname'...\n"; + print "# Running podchecker for '$testname'...\n"; ## Compare the output against the expected result + if ($^O eq 'VMS') { + for ($infile, $outfile, $cmpfile) { + $_ = VMS::Filespec::unixify($_) unless ref; + } + } podchecker($infile, $outfile); if ( testcmp({'-cmplines' => \&msgcmp}, $outfile, $cmpfile) ) { $different = "$outfile is different from $cmpfile"; @@ -96,12 +96,12 @@ sub testpodchecker( @ ) { 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\"" . " podchecker test ...\n"; podchecker($podfile, $cmpfile); } else { - print "+ File $cmpfile already exists" . + print "# File $cmpfile already exists" . " (use '-force' to regenerate it).\n"; } next; @@ -113,13 +113,13 @@ sub testpodchecker( @ ) { -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"; } }