7132857c6aabc5ba3ab51bcc18134eb8c90c6a06
[dbsrgits/DBIx-Class.git] / xt / footers.t
1 use warnings;
2 use strict;
3
4 use Test::More;
5 use File::Find;
6
7 my $boilerplate_headings = q{
8 =head1 FURTHER QUESTIONS?
9
10 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
11
12 =head1 COPYRIGHT AND LICENSE
13
14 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
15 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
16 redistribute it and/or modify it under the same terms as the
17 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
18 };
19
20 find({
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
52 done_testing;