Commit | Line | Data |
15c40696 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | use File::Temp qw/ tempdir /; |
6 | use Catalyst::Utils; |
7 | use File::Spec; |
8 | use Path::Class qw/ dir /; |
9 | use Cwd qw/ cwd /; |
10 | |
11 | my @dists = Catalyst::Utils::dist_indicator_file_list(); |
12 | is(scalar(@dists), 3, 'Makefile.PL Build.PL dist.ini'); |
13 | |
14 | my $cwd = cwd(); |
15 | foreach 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 |
33 | chdir($cwd); |
34 | |
35 | done_testing; |
36 | |