use inlined module hiding in tests
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_script_server-without_modules.t
index 215ca69..d6bbcaf 100644 (file)
@@ -1,15 +1,28 @@
 use strict;
 use warnings;
 use FindBin qw/$Bin/;
+
+# Package::Stash::XS has a weird =~ XS invocation during its compilation
+# This interferes with @INC hooks that do rematcuing on their own on
+# perls before 5.8.7. Just use the PP version to work around this.
+BEGIN { $ENV{PACKAGE_STASH_IMPLEMENTATION} = 'PP' if $] < '5.008007' }
+
 use Test::More;
-use Test::Without::Module qw(
-    Starman
+use Try::Tiny;
+
+my %hidden = map { (my $m = "$_.pm") =~ s{::}{/}g; $m => 1 } qw(
+    Starman::Server
     Plack::Handler::Starman
     MooseX::Daemonize
     MooseX::Daemonize::Pid::File
     MooseX::Daemonize::Core
 );
-require "$Bin/../aggregate/unit_core_script_server.t";
+local @INC = (sub {
+  return unless exists $hidden{$_[1]};
+  die "Can't locate $_[1] in \@INC (hidden)\n";
+}, @INC);
 
-1;
+do "$Bin/../aggregate/unit_core_script_server.t"
+  or die $@ || 'test returned false';
 
+1;