summaryrefslogtreecommitdiff
path: root/t/path-class.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-05-25 00:55:18 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-05-25 00:55:18 +0000
commit475e3c7cb559a68109d8c90ab8ff0b6a37c98793 (patch)
treec1b5b4aab1e8ecc28bc7a52eca7fb7d740ff0547 /t/path-class.t
downloadFile-Spec-Native-tarball-master.tar.gz
File-Spec-Native-1.004HEADFile-Spec-Native-1.004master
Diffstat (limited to 't/path-class.t')
-rw-r--r--t/path-class.t34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/path-class.t b/t/path-class.t
new file mode 100644
index 0000000..5b4c922
--- /dev/null
+++ b/t/path-class.t
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+use Test::More;
+
+eval q{ use Path::Class qw(file foreign_file); 1 }
+ or plan skip_all => 'Path::Class required for these tests';
+
+plan tests => 4;
+
+{
+ my $f = file(qw(foo bar));
+ my $fs = $f->stringify;
+
+ my $n = $f->as_foreign('Native');
+ my $ns = $n->stringify;
+
+ is($fs, $ns, 'Native == file()');
+}
+
+{
+ my @path = qw( y a p c ); # can you tell i wish i was there?
+ my $current = $File::Spec::ISA[0];
+
+ my ($format, $exp) = ( $current eq 'Win32'
+ ? (qw(Unix y/a/p/c))
+ : (qw(Win32 y\a\p\c))
+ );
+ my $fsclass = "File::Spec::$format";
+
+ my $f = foreign_file($format => @path);
+ is($f->stringify, $exp, "$format file path");
+ is($f->stringify, $fsclass->catfile(@path), "same as $fsclass");
+ is($f->as_foreign("Native")->stringify, File::Spec->catfile(@path), 'as_foreign("Native") same as File::Spec');
+}