File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -5371,6 +5371,7 @@ t/porting/bincompat.t Check that {non_,}bincompat_options are ordered
5371
5371
t/porting/checkcase.t Check whether we are case-insensitive-fs-friendly
5372
5372
t/porting/checkcfgvar.t Check that all config.sh-like files are good
5373
5373
t/porting/cmp_version.t Test whether all changed module files have their VERSION bumped
5374
+ t/porting/copyright.t Check that copyright years match
5374
5375
t/porting/customized.dat Data file for porting/customized.t
5375
5376
t/porting/customized.t Check all CUSTOMIZED files are as they should be
5376
5377
t/porting/diag.t Test completeness of perldiag.pod
Original file line number Diff line number Diff line change
1
+ # !perl
2
+
3
+ =head1 NAME
4
+
5
+ copyright.t
6
+
7
+ =head1 DESCRIPTION
8
+
9
+ Tests that the latest copyright years in the top-level README file and the
10
+ C<perl -v > output match each other.
11
+
12
+ If the test fails, update at least one of README and perl.c so that they match
13
+ reality.
14
+
15
+ =cut
16
+
17
+
18
+ use TestInit;
19
+ use strict;
20
+ BEGIN { require ' test.pl' }
21
+
22
+
23
+ my $readme_year = readme_year();
24
+ my $v_year = v_year();
25
+ is $readme_year , $v_year , ' README and perl -v copyright dates match' ;
26
+
27
+ done_testing;
28
+
29
+
30
+ sub readme_year
31
+ # returns the latest copyright year from the top-level README file
32
+ {
33
+
34
+ open my $readme , ' <' , ' ../README' or die " Opening README failed: $! " ;
35
+
36
+ # The copyright message is the first paragraph:
37
+ local $/ = ' ' ;
38
+ my $copyright_msg = <$readme >;
39
+
40
+ my ($year ) = $copyright_msg =~ / .*\b (\d {4,})/s
41
+ or die " Year not found in README copyright message '$copyright_msg '" ;
42
+
43
+ $year ;
44
+ }
45
+
46
+
47
+ sub v_year
48
+ # returns the latest copyright year shown in perl -v
49
+ {
50
+
51
+ my $output = runperl switches => [' -v' ];
52
+ my ($year ) = $output =~ / copyright 1987.*\b (\d {4,})/i
53
+ or die " Copyright statement not found in perl -v output '$output '" ;
54
+
55
+ $year ;
56
+ }
You can’t perform that action at this time.
0 commit comments