Factor SQL-standard deferred FK checks into a component
[dbsrgits/DBIx-Class.git] / xt / strictures.t
index 9e94cfa..adfd9a7 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 
 use Test::More;
 use lib 't/lib';
-use DBICTest ':GlobalLock';
+use DBICTest;
 
 unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_strictures') ) {
   my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_strictures');
@@ -12,9 +12,18 @@ unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_strictures') ) {
     : plan skip_all => "Test needs: $missing"
 }
 
-
 use File::Find;
 
+# The rationale is - if we can load all our optdeps
+# that are related to lib/ - then we should be able to run
+# perl -c checks (via syntax_ok), and all should just work
+my $missing_groupdeps_present = grep
+  { DBIx::Class::Optional::Dependencies->req_ok_for($_) }
+  grep
+    { $_ !~ /^ (?: test | rdbms | dist ) _ /x }
+    keys %{DBIx::Class::Optional::Dependencies->req_group_list}
+;
+
 find({
   wanted => sub {
     -f $_ or return;
@@ -23,12 +32,6 @@ find({
     return if m{^(?:
       maint/Makefile.PL.inc/.+                        # all the maint inc snippets are auto-strictured
         |
-      lib/DBIx/Class/Admin/Types.pm                   # MooseX::Types undetected
-        |
-      lib/DBIx/Class/Storage/DBI/Replicated/Types.pm  # MooseX::Types undetected
-        |
-      lib/DBIx/Class/Storage/BlockRunner.pm           # Moo undetected
-        |
       t/lib/DBICTest/Util/OverrideRequire.pm          # no stictures by design (load order sensitive)
     )$}x;
 
@@ -37,7 +40,8 @@ find({
     Test::Strict::strict_ok($f);
     Test::Strict::warnings_ok($f);
 
-    #Test::Strict::syntax_ok($f) if $f =~ /^ (?: lib  )/x;
+    Test::Strict::syntax_ok($f)
+      if ! $missing_groupdeps_present and $f =~ /^ (?: lib  )/x;
   },
   no_chdir => 1,
 }, (qw(lib t examples maint)) );