Better abs2rel/rel2abs/canonpath tests
Michael G. Schwern [Wed, 5 Dec 2001 19:52:58 +0000 (14:52 -0500)]
Message-ID: <20011205195257.A903@blackrider>

p4raw-id: //depot/perl@13483

MANIFEST
lib/File/Spec/t/Functions.t [moved from lib/File/Spec/Functions.t with 100% similarity, mode: 0644]
lib/File/Spec/t/Spec.t [moved from lib/File/Spec.t with 100% similarity, mode: 0644]
lib/File/Spec/t/rel2abs2rel.t [new file with mode: 0644]

index b69db59..d528677 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -965,12 +965,13 @@ lib/File/Find/t/taint.t           See if File::Find works with taint
 lib/File/Path.pm               Do things like `mkdir -p' and `rm -r'
 lib/File/Path.t                        See if File::Path works
 lib/File/Spec.pm               portable operations on file names
-lib/File/Spec.t                        See if File::Spec works
 lib/File/Spec/Epoc.pm          portable operations on EPOC file names
 lib/File/Spec/Functions.pm     Function interface to File::Spec object methods
-lib/File/Spec/Functions.t      See if File::Spec::Functions works
 lib/File/Spec/Mac.pm           portable operations on Mac file names
 lib/File/Spec/OS2.pm           portable operations on OS2 file names
+lib/File/Spec/t/Functions.t     See if File::Spec::Functions works
+lib/File/Spec/t/rel2abs2rel.t   See if File::Spec->rel2abs/abs2rel works
+lib/File/Spec/t/Spec.t         See if File::Spec works
 lib/File/Spec/Unix.pm          portable operations on Unix file names
 lib/File/Spec/VMS.pm           portable operations on VMS file names
 lib/File/Spec/Win32.pm         portable operations on Win32 file names
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from lib/File/Spec/Functions.t
rename to lib/File/Spec/t/Functions.t
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from lib/File/Spec.t
rename to lib/File/Spec/t/Spec.t
diff --git a/lib/File/Spec/t/rel2abs2rel.t b/lib/File/Spec/t/rel2abs2rel.t
new file mode 100644 (file)
index 0000000..69232d9
--- /dev/null
@@ -0,0 +1,27 @@
+#!./perl -w
+
+# Herein we apply abs2rel, rel2abs and canonpath against various real
+# world files and make sure it all actually works.
+
+BEGIN {
+    chdir 't';
+    @INC = '../lib';
+}
+
+use Test::More tests => 5;
+use File::Spec;
+
+# Here we make sure File::Spec can properly deal with executables.
+# VMS has some trouble with these.
+my $perl = File::Spec->rel2abs($^X);
+is( `$^X   -le "print 'ok'"`, "ok\n",   '`` works' );
+is( `$perl -le "print 'ok'"`, "ok\n",   'rel2abs($^X)' );
+
+$perl = File::Spec->canonpath($perl);
+is( `$perl -le "print 'ok'"`, "ok\n",   'canonpath on abs executable' );
+
+$perl = File::Spec->abs2rel($perl);
+is( `$perl -le "print 'ok'"`, "ok\n",   'abs2rel()' );
+
+$perl = File::Spec->canonpath($^X);
+is( `$perl -le "print 'ok'"`, "ok\n",   'canonpath on rel executable' );