X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Funit_utils_subdir.t;h=8a7865582faec1ea6dac8eb95605607d90aa533e;hp=8509bea8ab23e673a6726d717ca357e31dd926ba;hb=2a8074980f232951ffa0f4ea52a2f195f7a0813f;hpb=69b95ff3efb16d412d4658996fbd722fda411c50 diff --git a/t/unit_utils_subdir.t b/t/unit_utils_subdir.t index 8509bea..8a78655 100644 --- a/t/unit_utils_subdir.t +++ b/t/unit_utils_subdir.t @@ -1,32 +1,44 @@ -use Test::More tests=>7; +use Test::More tests => 8; use strict; use warnings; # simulates an entire testapp rooted at t/something -# except without bothering creating it since its +# 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"); + 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"); + 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"); + 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' ); +}