File: unit_utils_home.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (36 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use warnings;

use Test::More;
use File::Temp qw/ tempdir /;
use Catalyst::Utils;
use File::Spec;
use Path::Class qw/ dir /;
use Cwd qw/ cwd /;

my @dists = Catalyst::Utils::dist_indicator_file_list();
is(scalar(@dists), 4, 'Makefile.PL Build.PL dist.ini cpanfile');

my $cwd = cwd();
foreach my $inc ('', 'lib', 'blib'){
    my $d = tempdir(CLEANUP => 1);
    chdir($d);
    local $INC{'MyApp.pm'} = File::Spec->catfile($d, $inc, 'MyApp.pm');
    ok !Catalyst::Utils::home('MyApp'), "No files found inc $inc";
    open(my $fh, '>', "Makefile.PL");
    close($fh);
    is Catalyst::Utils::home('MyApp'), dir($d)->absolute->cleanup, "Did find inc '$inc'";
}

{
    my $d = tempdir(CLEANUP => 1);
    local $INC{'MyApp.pm'} = File::Spec->catfile($d, 'MyApp.pm');
    ok !Catalyst::Utils::home('MyApp'), 'No files found';
    mkdir File::Spec->catdir($d, 'MyApp');
    is Catalyst::Utils::home('MyApp'), dir($d, 'MyApp')->absolute->cleanup;
}

chdir($cwd);

done_testing;