File: unit_utils_subdir.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 (44 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (8)
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
37
38
39
40
41
42
43
44
use Test::More tests => 8;

use strict;
use warnings;

# simulates an entire testapp rooted at t/something
# except without bothering creating it since it's
# only the -e check on the Makefile.PL that matters

BEGIN { use_ok 'Catalyst::Utils' }
use FindBin;
use Path::Class::Dir;

{
    $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/../../lib/TestApp.pm";
    my $home = Catalyst::Utils::home('TestApp');
    like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
    unlike($home, qr{[\/\\]script[\/\\]foo}, "doesn't have path /script/foo");
}

{
    $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/bar/../../../lib/TestApp.pm";
    my $home = Catalyst::Utils::home('TestApp');
    like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
    unlike($home, qr{[\/\\]script[\/\\]foo[\/\\]bar}, "doesn't have path /script/foo/bar");
}

{
    $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/../lib/TestApp.pm";
    my $home = Catalyst::Utils::home('TestApp');
    like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
    unlike($home, qr{[\/\\]script[\/\\]foo}, "doesn't have path /script/foo");
}

{
    $INC{'TestApp.pm'} = "TestApp.pm";
    my $dir = "$FindBin::Bin/something";
    chdir( $dir );

    my $home = Catalyst::Utils::home('TestApp');

    $dir = Path::Class::Dir->new( $dir );
    is( $home, "$dir", 'same dir loading' );
}