diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | pod/perldelta.pod | 9 | ||||
-rw-r--r-- | t/porting/pending-author.t | 60 |
3 files changed, 70 insertions, 0 deletions
@@ -5375,6 +5375,7 @@ t/porting/globvar.t Check that globvar.sym is sane t/porting/known_pod_issues.dat Data file for porting/podcheck.t t/porting/maintainers.t Test that Porting/Maintainers.pl is up to date t/porting/manifest.t Test that this MANIFEST file is well formed +t/porting/pending-author.t Check if any pending commit would break tests t/porting/perlfunc.t Test that Functions_pm.PL can parse perlfunc.pod t/porting/podcheck.t Test the POD of shipped modules is well formed t/porting/pod_rules.t Check that various pod lists are consistent diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 3eec149e73..aaf6027ab3 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -583,6 +583,15 @@ that they represent may be covered elsewhere. =item * +F<t/porting/pending-author.t> has been added, to avoid the problem of +C<make test> passing 100%, but the subsequent git commit causing +F<t/porting/authors.t> to fail, because it uses a "new" e-mail address. + +This test is only run if one is building inside a git checkout, B<and> one +has made local changes. Otherwise it's skipped. + +=item * + F<t/porting/perlfunc.t> has been added, to test that changes to F<pod/perlfunc.pod> do not inadvertently break the build of L<Pod::Functions>. diff --git a/t/porting/pending-author.t b/t/porting/pending-author.t new file mode 100644 index 0000000000..6bc392b35c --- /dev/null +++ b/t/porting/pending-author.t @@ -0,0 +1,60 @@ +#!./perl -w + +# What does this test? +# This uses Porting/checkAUTHORS.pl to check that any pending commit isn't +# about to break t/porting/authors.t +# +# Why do we test this? +# t/porting/authors.t checks that the AUTHORS file is up to date, accounting +# for the "Author:" of every commit. However, any pending changes can't be +# tested, which leaves a gotcha - "make test" can pass, one then commits +# the passing code, pushes it uptream, and tests fail. So this test attempts +# to spot that problem before it happens, where it can. +# +# It's broken - how do I fix it? +# It will fail if you're in a git checkout, have uncommitted changes, and the +# e-mail address that your commit will default to is in AUTHORS, or the list +# of author aliases in Porting/checkAUTHORS.pl. So one of +# a) reset your pending changes +# b) change your git config user.email to the previously-known e-mail address +# c) add yourself to AUTHORS +# d) add an alias to Porting/checkAUTHORS.pl + +BEGIN { + @INC = '..' if -f '../TestInit.pm'; +} +use TestInit qw(T A); # T is chdir to the top level, A makes paths absolute +use strict; + +require 't/test.pl'; +find_git_or_skip('all'); + +my $changes; +foreach (`git status --porcelain 2>/dev/null`) { + next if /^\?\?/; + ++$changes; + last; +} + +skip_all("No pending changes (or git status --porcelain doesn't work here)") + unless $changes; + +sub get { + my $key = shift; + my $value = `git config --get user.$key`; + unless (defined $value && $value =~ /\S/) { + plan(1); + like($value, qr/\S/, "git config --get user.$key returned a value"); + exit 1; + } + chomp $value; + return $value; +} + +my $email = get('email'); +my $name = get('name'); + +open my $fh, '|-', "$^X Porting/checkAUTHORS.pl --tap -" + or die $!; +print $fh "Author: $name <$email>\n"; +close $fh or die $!; |