This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In t/ avoid using File::Spec for paths only used by Perl.
authorNicholas Clark <nick@ccl4.org>
Thu, 24 Feb 2011 10:06:35 +0000 (10:06 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 09:13:49 +0000 (09:13 +0000)
All platforms Perl builds on can already support Unix-style paths (given that
make_ext.pl is using them). This makes 7 more tests pass under minitest, which
doesn't build File::Spec, because it's part of an XS module.

t/io/fs.t
t/op/readline.t
t/run/switchx.t
t/uni/case.pl
t/uni/fold.t

index 64fcc5b..1cdddec 100644 (file)
--- a/t/io/fs.t
+++ b/t/io/fs.t
@@ -7,7 +7,6 @@ BEGIN {
 }
 
 use Config;
-use File::Spec::Functions;
 
 my $Is_VMSish = ($^O eq 'VMS');
 
@@ -66,7 +65,7 @@ else {
     `rm -f $tmpdir 2>/dev/null; mkdir $tmpdir 2>/dev/null`;
 }
 
-chdir catdir(curdir(), $tmpdir);
+chdir $tmpdir;
 
 `/bin/rm -rf a b c x` if -x '/bin/rm';
 
index d2c2c6f..81ac9e0 100644 (file)
@@ -61,9 +61,8 @@ foreach my $l (1, 21) {
 }
 
 use strict;
-use File::Spec;
 
-open F, File::Spec->curdir and sysread F, $_, 1;
+open F, '.' and sysread F, $_, 1;
 my $err = $! + 0;
 close F;
 
@@ -71,13 +70,13 @@ SKIP: {
   skip "you can read directories as plain files", 2 unless( $err );
 
   $!=0;
-  open F, File::Spec->curdir and $_=<F>;
+  open F, '.' and $_=<F>;
   ok( $!==$err && !defined($_) => 'readline( DIRECTORY )' );
   close F;
 
   $!=0;
   { local $/;
-    open F, File::Spec->curdir and $_=<F>;
+    open F, '.' and $_=<F>;
     ok( $!==$err && !defined($_) => 'readline( DIRECTORY ) slurp mode' );
     close F;
   }
index 1c61ba8..75dd50d 100644 (file)
@@ -6,15 +6,14 @@ BEGIN {
 }
 
 require './test.pl';
-use File::Spec::Functions;
 
 # Test '-x'
 print runperl( switches => ['-x'],
-               progfile => catfile(curdir(), 'run', 'switchx.aux') );
+               progfile => 'run/switchx.aux' );
 
 # Test '-xdir'
-print runperl( switches => ['-x' . catfile(curdir(), 'run')],
-               progfile => catfile(curdir(), 'run', 'switchx2.aux'),
+print runperl( switches => ['-x./run'],
+               progfile => 'run/switchx2.aux',
                args     => [ 3 ] );
 
 # EOF
index fcb43de..8a2f752 100644 (file)
@@ -1,5 +1,3 @@
-use File::Spec;
-
 require "test.pl";
 
 sub unidump {
@@ -22,9 +20,7 @@ sub casetest {
                    },
                   )} @funcs;
 
-    my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir,
-                                                     "lib", "unicore", "To"),
-                                  "$base.pl");
+    my $file = "../lib/unicore/To/$base.pl";
     my $simple = do $file or die $@;
     my %simple;
     for my $i (split(/\n/, $simple)) {
index a8cd384..d481b53 100644 (file)
@@ -11,15 +11,12 @@ BEGIN {
 
 binmode *STDOUT, ":utf8";
 
-use File::Spec;
 our $TODO;
 
 plan("no_plan");
 
 # Read in the official case folding definitions.
-my $CF = File::Spec->catfile(File::Spec->catdir(File::Spec->updir,
-                                              "lib", "unicore"),
-                           "CaseFolding.txt");
+my $CF = '../lib/unicore/CaseFolding.txt';
 
 die qq[$0: failed to open "$CF": $!\n] if ! open(my $fh, "<", $CF);