Get rid of Path::Class ( that *does* feel good )
[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
33     my $data = slurp_bytes $fn;
34
35     if ($data !~ /^=head1 NAME/m) {
36
37       # the generator is full of false positives, .pod is where it's at
38       return if $fn =~ qr{\Qlib/DBIx/Class/Optional/Dependencies.pm};
39
40       ok ( $data !~ /\bcopyright\b/i, "No copyright notices in $fn without apparent POD" );
41     }
42     elsif ($fn =~ qr{\Qlib/DBIx/Class.}) {
43       # nothing to check there - a static set of words
44     }
45     else {
46       ok ( $data !~ / ^ =head1 \s $_ /xmi, "No standalone $_ headings in $fn" )
47         for qw(AUTHOR CONTRIBUTOR LICENSE LICENCE);
48
49       ok ( $data !~ / ^ =head1 \s COPYRIGHT \s (?! AND \s LICENSE )/xmi, "No standalone COPYRIGHT headings in $fn" );
50
51       ok ($data =~ / \Q$boilerplate_headings\E (?! .*? ^ =head )/xms, "Expected headings found at the end of $fn");
52     }
53   },
54   no_chdir => 1,
55 }, (qw(lib examples)) );
56
57 done_testing;