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