Commit | Line | Data |
01033d73 |
1 | use strict; |
2 | use warnings; |
3 | |
5b19d407 |
4 | use Test::More; |
0891873b |
5 | use FindBin; |
6 | use Path::Class; |
7 | use File::Basename; |
01033d73 |
8 | |
9 | my %non_unix = ( |
10 | MacOS => 1, |
11 | MSWin32 => 1, |
12 | os2 => 1, |
13 | VMS => 1, |
14 | epoc => 1, |
15 | NetWare => 1, |
16 | dos => 1, |
17 | cygwin => 1 |
18 | ); |
19 | |
20 | my $os = $non_unix{$^O} ? $^O : 'Unix'; |
21 | |
0891873b |
22 | if ( $os ne 'Unix' ) { |
c7ded7aa |
23 | plan skip_all => 'tests require Unix'; |
5b19d407 |
24 | } |
01033d73 |
25 | |
01033d73 |
26 | use_ok('Catalyst'); |
27 | |
fa32ac82 |
28 | my $context = 'Catalyst'; |
29 | |
2e4a8275 |
30 | delete $ENV{CATALYST_HOME}; # otherwise it'll set itself up to the wrong place |
31 | |
0891873b |
32 | $context->setup_home; |
33 | my $base = dir($FindBin::Bin)->relative->stringify; |
34 | |
35 | isa_ok( Catalyst::path_to( $context, $base ), 'Path::Class::Dir' ); |
36 | isa_ok( Catalyst::path_to( $context, $base, basename $0 ), 'Path::Class::File' ); |
37 | |
fa32ac82 |
38 | my $config = Catalyst->config; |
39 | |
40 | $config->{home} = '/home/sri/my-app/'; |
01033d73 |
41 | |
42 | is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' ); |
43 | |
fa32ac82 |
44 | $config->{home} = '/Users/sri/myapp/'; |
01033d73 |
45 | |
46 | is( Catalyst::path_to( $context, 'foo', 'bar' ), |
47 | '/Users/sri/myapp/foo/bar', 'deep Unix path' ); |
0891873b |
48 | |
49 | done_testing; |