Re: File/Spec/t/rel2abs2rel2whatever broken again
[p5sagit/p5-mst-13.2.git] / lib / File / Spec / t / rel2abs2rel.t
1 #!./perl -w
2
3 # Herein we apply abs2rel, rel2abs and canonpath against various real
4 # world files and make sure it all actually works.
5
6 BEGIN {
7     chdir 't';
8     @INC = '../lib';
9 }
10
11 use Config;
12
13 use Test::More tests => 5;
14 use File::Spec;
15
16 # Change 'perl' to './perl' so the shell doesn't go looking through PATH.
17 sub safe_rel {
18     my($perl) = shift;
19     $perl = File::Spec->catfile(File::Spec->curdir, $perl) unless
20       File::Spec->file_name_is_absolute($perl);
21
22     return $perl;
23 }
24
25 # Here we make sure File::Spec can properly deal with executables.
26 # VMS has some trouble with these.
27 my $perl = safe_rel($^X);
28 is( `$perl   -le "print 'ok'"`, "ok\n",   '`` works' );
29
30 $perl = File::Spec->rel2abs($^X);
31 is( `$perl -le "print 'ok'"`, "ok\n",   'rel2abs($^X)' );
32
33 $perl = File::Spec->canonpath($perl);
34 is( `$perl -le "print 'ok'"`, "ok\n",   'canonpath on abs executable' );
35
36 $perl = safe_rel(File::Spec->abs2rel($perl));
37 is( `$perl -le "print 'ok'"`, "ok\n",   'abs2rel()' );
38
39 $perl = safe_rel(File::Spec->canonpath($^X));
40 is( `$perl -le "print 'ok'"`, "ok\n",   'canonpath on rel executable' );