Introduce GOVERNANCE document and empty RESOLUTIONS file.
[dbsrgits/DBIx-Class.git] / xt / extra / lean_startup.t
index 67a9b26..b53d1e8 100644 (file)
@@ -29,7 +29,7 @@ BEGIN {
         # exclude our test suite, known "module require-rs" and eval frames
         $caller[1] =~ / (?: \A | [\/\\] ) x?t [\/\\] /x
           or
-        $caller[0] =~ /^ (?: base | parent | Class::C3::Componentised | Module::Inspector | Module::Runtime ) $/x
+        $caller[0] =~ /^ (?: base | parent | Class::C3::Componentised | Module::Inspector | Module::Runtime | DBIx::Class::Optional::Dependencies ) $/x
           or
         $caller[3] eq '(eval)',
       )
@@ -43,10 +43,8 @@ BEGIN {
     # Some modules have a bare 'use $perl_version' as the first statement
     # Since the use() happens before 'package' had a chance to switch
     # the namespace, the shim thinks DBIC* tried to require this
-    return $res if $req =~ /^v?[0-9.]$/;
+    return $res if $req =~ /^v?[0-9.]+$/;
 
-    # exclude everything where the current namespace does not match the called function
-    # (this works around very weird XS-induced require callstack corruption)
     if (
       !$initial_inc_contents->{$req}
         and
@@ -55,19 +53,28 @@ BEGIN {
       @caller
         and
       $caller[0] =~ /^DBIx::Class/
-        and
-      (CORE::caller($up))[3] =~ /\Q$caller[0]/
     ) {
       local $stack{neutralize_override} = 1;
 
-      do 1 while CORE::caller(++$up);
+      # find last-most frame, to feed to T::B below
+      while( CORE::caller(++$up) ) { 1 }
 
       require('Test/More.pm');
       local $Test::Builder::Level = $up + 1;
+
+      # work around the trainwreck that is https://github.com/doy/package-stash-xs/pull/4
+      local $::TODO = 'sigh' if (
+        $INC{'Package/Stash/XS.pm'}
+          and
+        $req eq 'utf8'
+      );
+
       Test::More::fail ("Unexpected require of '$req' by $caller[0] ($caller[1] line $caller[2])");
 
-      require('DBICTest/Util.pm');
-      Test::More::diag( 'Require invoked' .  DBICTest::Util::stacktrace() );
+      unless( $::TODO ) {
+        require('DBICTest/Util.pm');
+        Test::More::diag( 'Require invoked' .  DBICTest::Util::stacktrace() );
+      }
     }
 
     return $res;
@@ -88,9 +95,6 @@ BEGIN {
   plan skip_all => 'Dependency load patterns are radically different before perl 5.10'
     if "$]" < 5.010;
 
-  plan skip_all => 'Dependency load patterns may be different on cperl - skip for now'
-    if $^V =~ /\d+c$/;
-
   # these envvars *will* bring in more stuff than the baseline
   delete @ENV{qw(
     DBIC_TRACE
@@ -101,6 +105,10 @@ BEGIN {
     DBICTEST_DEBUG_CONCURRENCY_LOCKS
   )};
 
+  # ensures the checker won't be disabled in
+  # t/lib/DBICTest/BaseSchema.pm
+  $ENV{DBIC_ASSERT_NO_FAILING_SANITY_CHECKS} = 1;
+
   $ENV{DBICTEST_ANFANG_DEFANG} = 1;
 
   # make sure extras do not load even when this is set
@@ -133,12 +141,10 @@ BEGIN {
 
     Carp
     namespace::clean
-    Try::Tiny
     Sub::Name
     Sub::Defer
     Sub::Quote
     attributes
-    File::Spec
 
     Scalar::Util
     Storable
@@ -147,6 +153,11 @@ BEGIN {
     Class::C3::Componentised
   ));
 
+  # load Storable ourselves here - there are too many
+  # variations with DynaLoader and XSLoader making testing
+  # for it rather unstable
+  require Storable;
+
   require DBIx::Class::Schema;
   assert_no_missing_expected_requires();
 }
@@ -172,6 +183,7 @@ BEGIN {
   register_lazy_loadable_requires(qw(
     DBI
     Hash::Merge
+    Data::Dumper
   ));
 
   {