Initial commit of Moosified Catalyst parts.
[catagits/Catalyst-Runtime.git] / t / unit_utils_subdir.t
1 use Test::More tests=>7;
2
3 use strict;
4 use warnings;
5
6 # simulates an entire testapp rooted at t/something
7 # except without bothering creating it since its
8 # only the -e check on the Makefile.PL that matters
9
10 BEGIN { use_ok 'Catalyst::Utils' }
11 use FindBin;
12
13 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/../../lib/TestApp.pm";
14 my $home = Catalyst::Utils::home('TestApp');
15 like($home, qr/t\/something/, "has path TestApp/t/something"); 
16 unlike($home, qr/\/script\/foo/, "doesn't have path /script/foo");
17
18 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/bar/../../../lib/TestApp.pm";
19 $home = Catalyst::Utils::home('TestApp');
20 like($home, qr/t\/something/, "has path TestApp/t/something"); 
21 unlike($home, qr/\/script\/foo\/bar/, "doesn't have path /script/foo");
22
23 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/../lib/TestApp.pm";
24 $home = Catalyst::Utils::home('TestApp');
25 like($home, qr/t\/something/, "has path TestApp/t/something"); 
26 unlike($home, qr/\/script\/foo/, "doesn't have path /script/foo");