Updating branch to current revision
[catagits/Catalyst-Runtime.git] / trunk / t / unit_utils_subdir.t
CommitLineData
e28a6876 1use Test::More tests => 8;
2
3use strict;
4use warnings;
5
6# simulates an entire testapp rooted at t/something
7# except without bothering creating it since it's
8# only the -e check on the Makefile.PL that matters
9
10BEGIN { use_ok 'Catalyst::Utils' }
11use FindBin;
12use Path::Class::Dir;
13
14{
15 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/../../lib/TestApp.pm";
16 my $home = Catalyst::Utils::home('TestApp');
17 like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
18 unlike($home, qr{[\/\\]script[\/\\]foo}, "doesn't have path /script/foo");
19}
20
21{
22 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/bar/../../../lib/TestApp.pm";
23 my $home = Catalyst::Utils::home('TestApp');
24 like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
25 unlike($home, qr{[\/\\]script[\/\\]foo[\/\\]bar}, "doesn't have path /script/foo/bar");
26}
27
28{
29 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/../lib/TestApp.pm";
30 my $home = Catalyst::Utils::home('TestApp');
31 like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
32 unlike($home, qr{[\/\\]script[\/\\]foo}, "doesn't have path /script/foo");
33}
34
35{
36 $INC{'TestApp.pm'} = "TestApp.pm";
37 my $dir = "$FindBin::Bin/something";
38 chdir( $dir );
39
40 my $home = Catalyst::Utils::home('TestApp');
41
42 $dir = Path::Class::Dir->new( $dir );
43 is( $home, "$dir", 'same dir loading' );
44}