diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-01-22 12:21:45 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-01-22 12:21:45 +0000 |
commit | 5733ee18d695ba28a43dca0608c7e220a495c6cb (patch) | |
tree | 567188c6e68c4abd76e06a6491edaea766ecc437 | |
parent | 9dce16cd064e70e66b1b719eba219ba6d0e7a001 (diff) | |
download | perl-5733ee18d695ba28a43dca0608c7e220a495c6cb.tar.gz |
Extend pod/buildtoc --test to validate that regenerated files are up to date.
-rw-r--r-- | pod/buildtoc | 19 | ||||
-rw-r--r-- | t/porting/buildtoc.t | 2 |
2 files changed, 14 insertions, 7 deletions
diff --git a/pod/buildtoc b/pod/buildtoc index 41ca6f8983..dd4509da32 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -32,8 +32,8 @@ $masterpodfile = abs_from_top('pod.lst'); # --build-all tries to build everything # --build-foo updates foo as follows # --showfiles shows the files to be changed -# --test exit early, exit if perl.pod, pod.lst, MANIFEST are -# consistent, die otherwise. +# --test exit if perl.pod, pod.lst, MANIFEST are consistent, and regenerated +# files are up to date, die otherwise. %Targets = ( @@ -251,13 +251,13 @@ close MASTER; unless $disk_pods{$i} or $BuildFiles{$i}; } if ($Test) { - print "1..1\n"; + delete $Build{toc}; + printf "1..%d\n", 1 + scalar keys %Build; if (@inconsistent) { print "not ok 1\n"; die @inconsistent } print "ok 1\n"; - exit; } else { warn @inconsistent if @inconsistent; @@ -751,7 +751,14 @@ while (my ($target, $name) = each %Targets) { if (defined $orig) { if ($new eq $orig) { - print "Was not modified\n" if $Verbose; + if ($Test) { + printf "ok %d # $name is up to date\n", $built + 1; + } elsif ($Verbose) { + print "Was not modified\n"; + } + next; + } elsif ($Test) { + printf "not ok %d # $name is up to date\n", $built + 1; next; } $mode = (stat $name)[2] // die "$0: Can't stat $name: $!"; @@ -767,4 +774,4 @@ while (my ($target, $name) = each %Targets) { } } -warn "$0: was not instructed to build anything\n" unless $built; +warn "$0: was not instructed to build anything\n" unless $built || $Test; diff --git a/t/porting/buildtoc.t b/t/porting/buildtoc.t index e1e521d572..47fa4a737c 100644 --- a/t/porting/buildtoc.t +++ b/t/porting/buildtoc.t @@ -8,4 +8,4 @@ BEGIN { use strict; my $dotslash = $^O eq "MSWin32" ? ".\\" : "./"; -system("${dotslash}perl -f -Ilib -I../lib pod/buildtoc --build-toc -q --test"); +system("${dotslash}perl -f -Ilib -I../lib pod/buildtoc --build-toc -q --test --build-all"); |