Commit | Line | Data |
3bb16ffc |
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 | |
f47fe535 |
11 | use Config; |
b15a22ab |
12 | |
3bb16ffc |
13 | use Test::More tests => 5; |
14 | use File::Spec; |
15 | |
1be805e9 |
16 | # Change 'perl' to './perl' so the shell doesn't go looking through PATH. |
17 | sub safe_rel { |
7fad1f89 |
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; |
1be805e9 |
23 | } |
24 | |
3bb16ffc |
25 | # Here we make sure File::Spec can properly deal with executables. |
26 | # VMS has some trouble with these. |
7fad1f89 |
27 | my $perl = safe_rel($^X); |
28 | is( `$perl -le "print 'ok'"`, "ok\n", '`` works' ); |
29 | |
30 | $perl = File::Spec->rel2abs($^X); |
3bb16ffc |
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 | |
42873cec |
36 | $perl = safe_rel(File::Spec->abs2rel($perl)); |
3bb16ffc |
37 | is( `$perl -le "print 'ok'"`, "ok\n", 'abs2rel()' ); |
38 | |
7fad1f89 |
39 | $perl = safe_rel(File::Spec->canonpath($^X)); |
3bb16ffc |
40 | is( `$perl -le "print 'ok'"`, "ok\n", 'canonpath on rel executable' ); |