c6757394b2ccd9394bc7d131f7ab1416ac456685
[catagits/Catalyst-Runtime.git] / t / unit / core / path_to.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::MockObject;
6
7 my %non_unix = (
8     MacOS   => 1,
9     MSWin32 => 1,
10     os2     => 1,
11     VMS     => 1,
12     epoc    => 1,
13     NetWare => 1,
14     dos     => 1,
15     cygwin  => 1
16 );
17
18 my $os = $non_unix{$^O} ? $^O : 'Unix';
19
20 if(  $os ne 'Unix' ) {
21         plan skip_all => 'tests require Unix';
22 }
23 else {
24         plan tests => 3;
25 }
26
27 my $context = Test::MockObject->new;
28
29 use_ok('Catalyst');
30
31 $context->mock( 'config', sub { { home => '/home/sri/my-app/' } } );
32
33 is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
34
35 $context->mock( 'config', sub { { home => '/Users/sri/myapp' } } );
36
37 is( Catalyst::path_to( $context, 'foo', 'bar' ),
38     '/Users/sri/myapp/foo/bar', 'deep Unix path' );