From: Michael G. Schwern Date: Wed, 13 Feb 2002 09:03:37 +0000 (+0000) Subject: Re: File/Spec/t/rel2abs2rel2whatever broken again X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7fad1f89ed5b3d3aaff6f445423d2a7d5e6a56b0;p=p5sagit%2Fp5-mst-13.2.git Re: File/Spec/t/rel2abs2rel2whatever broken again Message-Id: <20020213100017.GA6288@blackrider> p4raw-id: //depot/perl@14676 --- diff --git a/lib/File/Spec/t/rel2abs2rel.t b/lib/File/Spec/t/rel2abs2rel.t index 9d2ce2c..fff3a1b 100644 --- a/lib/File/Spec/t/rel2abs2rel.t +++ b/lib/File/Spec/t/rel2abs2rel.t @@ -15,13 +15,19 @@ use File::Spec; # Change 'perl' to './perl' so the shell doesn't go looking through PATH. sub safe_rel { - return File::Spec->catfile(File::Spec->curdir, $_[0]); + my($perl) = shift; + $perl = File::Spec->catfile(File::Spec->curdir, $perl) unless + File::Spec->file_name_is_absolute($perl); + + return $perl; } # 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' ); +my $perl = safe_rel($^X); +is( `$perl -le "print 'ok'"`, "ok\n", '`` works' ); + +$perl = File::Spec->rel2abs($^X); is( `$perl -le "print 'ok'"`, "ok\n", 'rel2abs($^X)' ); $perl = File::Spec->canonpath($perl); @@ -30,5 +36,5 @@ is( `$perl -le "print 'ok'"`, "ok\n", 'canonpath on abs executable' ); $perl = safe_rel(File::Spec->abs2rel($perl)); is( `$perl -le "print 'ok'"`, "ok\n", 'abs2rel()' ); -$perl = File::Spec->canonpath($^X); +$perl = safe_rel(File::Spec->canonpath($^X)); is( `$perl -le "print 'ok'"`, "ok\n", 'canonpath on rel executable' );