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