use inlined module hiding in tests
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_utils_home.t
CommitLineData
15c40696 1use strict;
2use warnings;
3
4use Test::More;
5use File::Temp qw/ tempdir /;
6use Catalyst::Utils;
7use File::Spec;
8use Path::Class qw/ dir /;
9use Cwd qw/ cwd /;
10
11my @dists = Catalyst::Utils::dist_indicator_file_list();
a943d722 12is(scalar(@dists), 4, 'Makefile.PL Build.PL dist.ini cpanfile');
15c40696 13
14my $cwd = cwd();
15foreach my $inc ('', 'lib', 'blib'){
16 my $d = tempdir(CLEANUP => 1);
17 chdir($d);
94d7a76e 18 local $INC{'MyApp.pm'} = File::Spec->catfile($d, $inc, 'MyApp.pm');
15c40696 19 ok !Catalyst::Utils::home('MyApp'), "No files found inc $inc";
20 open(my $fh, '>', "Makefile.PL");
21 close($fh);
22 is Catalyst::Utils::home('MyApp'), dir($d)->absolute->cleanup, "Did find inc '$inc'";
23}
24
25{
26 my $d = tempdir(CLEANUP => 1);
94d7a76e 27 local $INC{'MyApp.pm'} = File::Spec->catfile($d, 'MyApp.pm');
15c40696 28 ok !Catalyst::Utils::home('MyApp'), 'No files found';
29 mkdir File::Spec->catdir($d, 'MyApp');
30 is Catalyst::Utils::home('MyApp'), dir($d, 'MyApp')->absolute->cleanup;
31}
32
15c40696 33chdir($cwd);
34
35done_testing;
36