Work around the FIXME in the previous commit
[dbsrgits/DBIx-Class.git] / xt / dist / strictures.t
CommitLineData
c0329273 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
cb551b07 2use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_strictures';
3
4a233f30 4use warnings;
5use strict;
6
7use Test::More;
cb551b07 8use File::Find;
261a9d64 9use File::Spec;
10use Config;
c0329273 11
dfaed1c7 12use 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
17my $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
26my $tainted_relpath = (
5f0174dc 27 DBIx::Class::_ENV_::TAINT_MODE
261a9d64 28 and
5f0174dc 29 length $ENV{PATH}
261a9d64 30 and
31 grep
32 { ! File::Spec->file_name_is_absolute($_) }
33 split /\Q$Config{path_sep}/, $ENV{PATH}
34) ? 1 : 0;
35
4a233f30 36find({
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 |
2ff02982 44 t/lib/DBICTest/WithTaint.pm # no stictures by design (trips up local::lib on older perls)
45 |
4a233f30 46 t/lib/DBICTest/Util/OverrideRequire.pm # no stictures by design (load order sensitive)
cb551b07 47 |
c0329273 48 t/lib/ANFANG.pm # no stictures by design (load speed sensitive)
49 |
50 lib/DBIx/Class/Optional/Dependencies.pm # no stictures by design (load speed sensitive)
399b9455 51 |
52 lib/DBIx/Class/StartupCheck.pm # no stictures by design (load speed sensitive)
53 |
54 lib/DBIx/Class/_TempExtlib/.+
4a233f30 55 )$}x;
56
57 my $f = $_;
58
59 Test::Strict::strict_ok($f);
60 Test::Strict::warnings_ok($f);
61
261a9d64 62 Test::Strict::syntax_ok($f) if (
63 ! $tainted_relpath
64 and
65 ! $missing_groupdeps_present
66 and
67 $f =~ /^ (?: lib )/x
68 );
4a233f30 69 },
70 no_chdir => 1,
71}, (qw(lib t examples maint)) );
72
73done_testing;