Move a number of tests to xt, restructure extra lists
[dbsrgits/DBIx-Class.git] / xt / dist / postdistdir / pod_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
27     my $data = do { local (@ARGV, $/) = $fn; <> };
28
29     if ($data !~ /^=head1 NAME/m) {
30
31       # the generator is full of false positives, .pod is where it's at
32       return if $fn =~ qr{\Qlib/DBIx/Class/Optional/Dependencies.pm};
33
34       ok ( $data !~ /\bcopyright\b/i, "No copyright notices in $fn without apparent POD" );
35     }
36     elsif ($fn =~ qr{\Qlib/DBIx/Class.}) {
37       # nothing to check there - a static set of words
38     }
39     else {
40       ok ( $data !~ / ^ =head1 \s $_ /xmi, "No standalone $_ headings in $fn" )
41         for qw(AUTHOR CONTRIBUTOR LICENSE LICENCE);
42
43       ok ( $data !~ / ^ =head1 \s COPYRIGHT \s (?! AND \s LICENSE )/xmi, "No standalone COPYRIGHT headings in $fn" );
44
45       ok ($data =~ / \Q$boilerplate_headings\E (?! .*? ^ =head )/xms, "Expected headings found at the end of $fn");
46     }
47   },
48   no_chdir => 1,
49 }, (qw(lib examples)) );
50
51 done_testing;