Clarify licensing, ensure footers are consistent throughout the project
[dbsrgits/DBIx-Class.git] / xt / footers.t
CommitLineData
a2bd3796 1use warnings;
2use strict;
3
4use Test::More;
5use File::Find;
6
7my $boilerplate_headings = q{
8=head1 FURTHER QUESTIONS?
9
10Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
11
12=head1 COPYRIGHT AND LICENSE
13
14This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
15by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
16redistribute it and/or modify it under the same terms as the
17L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
18};
19
20find({
21 wanted => sub {
22 my $fn = $_;
23
24 return unless -f $fn;
25 return unless $fn =~ / \. (?: pm | pod ) $ /ix;
26 return if $fn =~ qr{\Qlib/DBIx/Class/_TempExtlib/};
27
28 my $data = do { local (@ARGV, $/) = $fn; <> };
29
30 if ($data !~ /^=head1 NAME/m) {
31
32 # the generator is full of false positives, .pod is where it's at
33 return if $fn =~ qr{\Qlib/DBIx/Class/Optional/Dependencies.pm};
34
35 ok ( $data !~ /\bcopyright\b/i, "No copyright notices in $fn without apparent POD" );
36 }
37 elsif ($fn =~ qr{\Qlib/DBIx/Class.}) {
38 # nothing to check there - a static set of words
39 }
40 else {
41 ok ( $data !~ / ^ =head1 \s $_ /xmi, "No standalone $_ headings in $fn" )
42 for qw(AUTHOR CONTRIBUTOR LICENSE LICENCE);
43
44 ok ( $data !~ / ^ =head1 \s COPYRIGHT \s (?! AND \s LICENSE )/xmi, "No standalone COPYRIGHT headings in $fn" );
45
46 ok ($data =~ / \Q$boilerplate_headings\E (?! .*? ^ =head )/xms, "Expected headings found at the end of $fn");
47 }
48 },
49 no_chdir => 1,
50}, (qw(lib examples)) );
51
52done_testing;