File: unit_core_path_to.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (45 lines) | stat: -rw-r--r-- 845 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use strict;
use warnings;

use Test::More;
use FindBin;
use Path::Class;
use File::Basename;
BEGIN {
    delete $ENV{CATALYST_HOME}; # otherwise it'll set itself up to the wrong place
}
use lib "$FindBin::Bin/../lib";
use TestApp;

my %non_unix = (
    MacOS   => 1,
    MSWin32 => 1,
    os2     => 1,
    VMS     => 1,
    epoc    => 1,
    NetWare => 1,
    dos     => 1,
    cygwin  => 1
);

my $os = $non_unix{$^O} ? $^O : 'Unix';

if ( $os ne 'Unix' ) {
    plan skip_all => 'tests require Unix';
}

use_ok('Catalyst');

my $context = 'TestApp';
my $base;

isa_ok( $base = Catalyst::path_to( $context, '' ), 'Path::Class::Dir' );

my $config = Catalyst->config;

is( Catalyst::path_to( $context, 'foo' ), "$base/foo", 'Unix path' );

is( Catalyst::path_to( $context, 'foo', 'bar' ),
    "$base/foo/bar", 'deep Unix path' );

done_testing;