use inlined module hiding in tests
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_script_server-without_modules.t
1 use strict;
2 use warnings;
3 use FindBin qw/$Bin/;
4
5 # Package::Stash::XS has a weird =~ XS invocation during its compilation
6 # This interferes with @INC hooks that do rematcuing on their own on
7 # perls before 5.8.7. Just use the PP version to work around this.
8 BEGIN { $ENV{PACKAGE_STASH_IMPLEMENTATION} = 'PP' if $] < '5.008007' }
9
10 use Test::More;
11 use Try::Tiny;
12
13 my %hidden = map { (my $m = "$_.pm") =~ s{::}{/}g; $m => 1 } qw(
14     Starman::Server
15     Plack::Handler::Starman
16     MooseX::Daemonize
17     MooseX::Daemonize::Pid::File
18     MooseX::Daemonize::Core
19 );
20 local @INC = (sub {
21   return unless exists $hidden{$_[1]};
22   die "Can't locate $_[1] in \@INC (hidden)\n";
23 }, @INC);
24
25 do "$Bin/../aggregate/unit_core_script_server.t"
26   or die $@ || 'test returned false';
27
28 1;