Added release manager test for copyright year
authorSmylers <Smylers@stripey.com>
Fri, 6 Sep 2013 10:56:07 +0000 (11:56 +0100)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 10 Sep 2013 15:43:13 +0000 (08:43 -0700)
Porting/release_managers_guide.pod
t/porting/copyright.t

index e900f9c..4c7297f 100644 (file)
@@ -446,6 +446,16 @@ release, this would be 5.13.11).
 For BLEAD-POINT releases, it needs to refer to the previous BLEAD-POINT
 release (so for 5.15.3 this would be 5.15.2).
 
+=head3 Check copyright years
+
+Check that the copyright years are up to date by running:
+
+ $ ./perl t/porting/copyright.t --now
+
+Remedy any test failures by editing README or perl.c accordingly (search for
+the "Copyright"). If updating perl.c, check if the file's own copyright date in
+the C comment at the top needs updating, as well as the one printed by C<-v>.
+
 =head3 Check more build configurations
 
 Try running the full test suite against multiple Perl configurations. Here are
index e1b7faa..c95286d 100644 (file)
@@ -12,6 +12,10 @@ C<perl -v> output match each other.
 If the test fails, update at least one of README and perl.c so that they match
 reality.
 
+Optionally you can pass the C<--now> option to check they are at the current
+year. This isn't checked by default, so that it doesn't fail for people
+working on older releases. It should be run before making a new release.
+
 =cut
 
 
@@ -20,9 +24,25 @@ use strict;
 BEGIN { require 'test.pl' }
 
 
+my ($opt) = @ARGV;
+
 my $readme_year = readme_year();
 my $v_year = v_year();
-is $readme_year, $v_year, 'README and perl -v copyright dates match';
+
+# Check that both copyright dates are up-to-date, but only if requested, so
+# that tests still pass for people intentionally working on older versions:
+if ($opt eq '--now')
+{
+  my $current_year = (gmtime)[5] + 1900;
+  is $v_year, $current_year, 'perl -v copyright includes current year';
+  is $readme_year, $current_year, 'README copyright includes current year';
+}
+
+# Otherwise simply check that the two copyright dates match each other:
+else
+{
+  is $readme_year, $v_year, 'README and perl -v copyright dates match';
+}
 
 done_testing;