Add author test for use strict/warnings
[dbsrgits/DBIx-Class-Schema-Loader.git] / xt / strictures.t
1 use DBIx::Class::Schema::Loader::Optional::Dependencies
2     -skip_all_without => 'test_strictures';
3
4 use warnings;
5 use strict;
6
7 use Test::More;
8 use File::Find;
9 use lib 't/lib';
10
11 # The rationale is - if we can load all our optdeps
12 # that are related to lib/ - then we should be able to run
13 # perl -c checks (via syntax_ok), and all should just work
14 my $missing_groupdeps_present = grep
15   { DBIx::Class::Schema::Loader::Optional::Dependencies->req_ok_for($_) }
16   grep
17     { $_ !~ /^ (?: test | rdbms | dist ) _ /x }
18     keys %{DBIx::Class::Schema::Loader::Optional::Dependencies->req_group_list}
19 ;
20
21 find({
22   wanted => sub {
23     -f $_ or return;
24     m/\.(?: pm | pl | t )$ /ix or return;
25
26     return if m{^(?:
27       lib/DBIx/Class/Schema/Loader/Optional/Dependencies.pm         # no stictures by design (load speed sensitive)
28     )$}x;
29
30     my $f = $_;
31
32     Test::Strict::strict_ok($f);
33     Test::Strict::warnings_ok($f);
34
35     Test::Strict::syntax_ok($f)
36       if ! $missing_groupdeps_present and $f =~ /^ (?: lib  )/x;
37   },
38   no_chdir => 1,
39 }, (qw(lib t script maint)) );
40
41 done_testing;