Commit | Line | Data |
c0329273 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
cb551b07 |
2 | use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_strictures'; |
3 | |
4a233f30 |
4 | use warnings; |
5 | use strict; |
6 | |
7 | use Test::More; |
cb551b07 |
8 | use File::Find; |
261a9d64 |
9 | use File::Spec; |
10 | use Config; |
c0329273 |
11 | |
dfaed1c7 |
12 | use DBICTest; |
4a233f30 |
13 | |
18637ebb |
14 | # The rationale is - if we can load all our optdeps |
15 | # that are related to lib/ - then we should be able to run |
16 | # perl -c checks (via syntax_ok), and all should just work |
17 | my $missing_groupdeps_present = grep |
261a9d64 |
18 | { ! DBIx::Class::Optional::Dependencies->req_ok_for($_) } |
18637ebb |
19 | grep |
20 | { $_ !~ /^ (?: test | rdbms | dist ) _ /x } |
21 | keys %{DBIx::Class::Optional::Dependencies->req_group_list} |
22 | ; |
23 | |
261a9d64 |
24 | # don't test syntax when RT#106935 is triggered (mainly CI) |
25 | # FIXME - remove when RT is resolved |
26 | my $tainted_relpath = ( |
27 | length $ENV{PATH} |
28 | and |
29 | ${^TAINT} |
30 | and |
31 | grep |
32 | { ! File::Spec->file_name_is_absolute($_) } |
33 | split /\Q$Config{path_sep}/, $ENV{PATH} |
34 | ) ? 1 : 0; |
35 | |
4a233f30 |
36 | find({ |
37 | wanted => sub { |
38 | -f $_ or return; |
39 | m/\.(?: pm | pl | t )$ /ix or return; |
40 | |
41 | return if m{^(?: |
42 | maint/Makefile.PL.inc/.+ # all the maint inc snippets are auto-strictured |
43 | | |
4a233f30 |
44 | t/lib/DBICTest/Util/OverrideRequire.pm # no stictures by design (load order sensitive) |
cb551b07 |
45 | | |
c0329273 |
46 | t/lib/ANFANG.pm # no stictures by design (load speed sensitive) |
47 | | |
48 | lib/DBIx/Class/Optional/Dependencies.pm # no stictures by design (load speed sensitive) |
4a233f30 |
49 | )$}x; |
50 | |
51 | my $f = $_; |
52 | |
53 | Test::Strict::strict_ok($f); |
54 | Test::Strict::warnings_ok($f); |
55 | |
261a9d64 |
56 | Test::Strict::syntax_ok($f) if ( |
57 | ! $tainted_relpath |
58 | and |
59 | ! $missing_groupdeps_present |
60 | and |
61 | $f =~ /^ (?: lib )/x |
62 | ); |
4a233f30 |
63 | }, |
64 | no_chdir => 1, |
65 | }, (qw(lib t examples maint)) ); |
66 | |
67 | done_testing; |