File: native.t

package info (click to toggle)
libfile-spec-native-perl 1.003-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 212 kB
  • ctags: 1
  • sloc: perl: 160; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;
use Test::More;

use File::Spec ();
use File::Spec::Native ();

plan tests => 3;

my @path = qw(dumb module);
is(File::Spec->catfile(@path), File::Spec::Native->catfile(@path), 'base == Native');

use File::Spec::Functions qw(catdir);
is(catdir(@path), File::Spec::Native->catdir(@path), 'base == Native');

# try to find something that isn't the current OS
my $prefix = 'File::Spec';
my $detected = $File::Spec::ISA[0];

my $fsclass = "${prefix}::" . ($detected eq "${prefix}::Win32" ? 'Unix' : 'Win32');
eval "require $fsclass" or die $@;

my $foreign = $fsclass->catfile(@path);

isnt($foreign, File::Spec::Native->catfile(@path), "foreign ($fsclass) != native ($detected)");