override exit() in test using MooseX::Getopt
[catagits/Catalyst-Runtime.git] / t / unit_utils_subdir.t
CommitLineData
2f381252 1use Test::More tests => 8;
059c085b 2
3use strict;
4use warnings;
5
6# simulates an entire testapp rooted at t/something
43c58153 7# except without bothering creating it since it's
059c085b 8# only the -e check on the Makefile.PL that matters
9
10BEGIN { use_ok 'Catalyst::Utils' }
11use FindBin;
2f381252 12use Path::Class::Dir;
059c085b 13
2f381252 14{
15 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/../../lib/TestApp.pm";
16 my $home = Catalyst::Utils::home('TestApp');
43c58153 17 like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
2f381252 18 unlike($home, qr{[\/\\]script[\/\\]foo}, "doesn't have path /script/foo");
19}
059c085b 20
2f381252 21{
22 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/bar/../../../lib/TestApp.pm";
23 my $home = Catalyst::Utils::home('TestApp');
43c58153 24 like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
2f381252 25 unlike($home, qr{[\/\\]script[\/\\]foo[\/\\]bar}, "doesn't have path /script/foo/bar");
26}
059c085b 27
2f381252 28{
29 $INC{'TestApp.pm'} = "$FindBin::Bin/something/script/../lib/TestApp.pm";
30 my $home = Catalyst::Utils::home('TestApp');
43c58153 31 like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
2f381252 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 );
43c58153 39
2f381252 40 my $home = Catalyst::Utils::home('TestApp');
41
42 $dir = Path::Class::Dir->new( $dir );
43 is( $home, "$dir", 'same dir loading' );
44}