[PATCH] AIX test shouldn't trip OS/400 PASE
[p5sagit/p5-mst-13.2.git] / vms / ext / filespec.t
CommitLineData
acbb349e 1#!./perl
2
aa689395 3BEGIN { unshift(@INC,'../lib') if -d '../lib'; }
4
acbb349e 5use VMS::Filespec;
0e9538e6 6use File::Spec;
acbb349e 7
8foreach (<DATA>) {
9 chomp;
10 s/\s*#.*//;
11 next if /^\s*$/;
12 push(@tests,$_);
13}
cd5cd3a3 14
15require './test.pl';
16plan(tests => scalar(2*@tests)+6);
acbb349e 17
18foreach $test (@tests) {
cd5cd3a3 19 ($arg,$func,$expect) = split(/\s+/,$test);
20
acbb349e 21 $rslt = eval "$func('$arg')";
cd5cd3a3 22 is($@, '', "eval func('$arg')");
23 is($rslt, $expect, " result");
acbb349e 24}
25
17f28c40 26$defwarn = <<'EOW';
27# Note: This failure may have occurred because your default device
28# was set using a non-concealed logical name. If this is the case,
29# you will need to determine by inspection that the two resultant
30# file specifications shwn above are in fact equivalent.
31EOW
32
b4558e59 33is(uc(rmsexpand('[]')), "\U$ENV{DEFAULT}", 'rmsexpand()') || print $defwarn;
cd5cd3a3 34is(rmsexpand('from.here'),"\L$ENV{DEFAULT}from.here") || print $defwarn;
35is(rmsexpand('from'), "\L$ENV{DEFAULT}from") || print $defwarn;
36
37is(rmsexpand('from.here','cant:[get.there];2'),
38 'cant:[get.there]from.here;2') || print $defwarn;
39
acbb349e 40
09b7f37c 41# Make sure we're using redirected mkdir, which strips trailing '/', since
42# the CRTL's mkdir can't handle this.
cd5cd3a3 43ok(mkdir('testdir/',0777), 'using redirected mkdir()');
44ok(rmdir('testdir/'), ' rmdir()');
09b7f37c 45
acbb349e 46__DATA__
47
0e9538e6 48# lots of underscores used to minimize collision with existing logical names
49
acbb349e 50# Basic VMS to Unix filespecs
0e9538e6 51__some_:[__where_.__over_]__the_.__rainbow_ unixify /__some_/__where_/__over_/__the_.__rainbow_
52[.__some_.__where_.__over_]__the_.__rainbow_ unixify __some_/__where_/__over_/__the_.__rainbow_
53[-.__some_.__where_.__over_]__the_.__rainbow_ unixify ../__some_/__where_/__over_/__the_.__rainbow_
54[.__some_.--.__where_.__over_]__the_.__rainbow_ unixify __some_/../../__where_/__over_/__the_.__rainbow_
7fc7512a 55[.__some_...__where_.__over_]__the_.__rainbow_ unixify __some_/.../__where_/__over_/__the_.__rainbow_
0e9538e6 56[...__some_.__where_.__over_]__the_.__rainbow_ unixify .../__some_/__where_/__over_/__the_.__rainbow_
57[.__some_.__where_.__over_...]__the_.__rainbow_ unixify __some_/__where_/__over_/.../__the_.__rainbow_
58[.__some_.__where_.__over_...] unixify __some_/__where_/__over_/.../
59[.__some_.__where_.__over_.-] unixify __some_/__where_/__over_/../
acbb349e 60[] unixify ./
61[-] unixify ../
62[--] unixify ../../
f86702cc 63[...] unixify .../
acbb349e 64
65# and back again
0e9538e6 66/__some_/__where_/__over_/__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_
67__some_/__where_/__over_/__the_.__rainbow_ vmsify [.__some_.__where_.__over_]__the_.__rainbow_
68../__some_/__where_/__over_/__the_.__rainbow_ vmsify [-.__some_.__where_.__over_]__the_.__rainbow_
69__some_/../../__where_/__over_/__the_.__rainbow_ vmsify [-.__where_.__over_]__the_.__rainbow_
70.../__some_/__where_/__over_/__the_.__rainbow_ vmsify [...__some_.__where_.__over_]__the_.__rainbow_
71__some_/.../__where_/__over_/__the_.__rainbow_ vmsify [.__some_...__where_.__over_]__the_.__rainbow_
72/__some_/.../__where_/__over_/__the_.__rainbow_ vmsify __some_:[...__where_.__over_]__the_.__rainbow_
73__some_/__where_/... vmsify [.__some_.__where_...]
74/__where_/... vmsify __where_:[...]
acbb349e 75. vmsify []
76.. vmsify [-]
77../.. vmsify [--]
f86702cc 78.../ vmsify [...]
491527d0 79/ vmsify sys$disk:[000000]
acbb349e 80
81# Fileifying directory specs
0e9538e6 82__down_:[__the_.__garden_.__path_] fileify __down_:[__the_.__garden_]__path_.dir;1
83[.__down_.__the_.__garden_.__path_] fileify [.__down_.__the_.__garden_]__path_.dir;1
84/__down_/__the_/__garden_/__path_ fileify /__down_/__the_/__garden_/__path_.dir;1
85/__down_/__the_/__garden_/__path_/ fileify /__down_/__the_/__garden_/__path_.dir;1
86__down_/__the_/__garden_/__path_ fileify __down_/__the_/__garden_/__path_.dir;1
87__down_:[__the_.__garden_]__path_ fileify __down_:[__the_.__garden_]__path_.dir;1
88__down_:[__the_.__garden_]__path_. fileify # N.B. trailing . ==> null type
89__down_:[__the_]__garden_.__path_ fileify
90/__down_/__the_/__garden_/__path_. fileify # N.B. trailing . ==> null type
91/__down_/__the_/__garden_.__path_ fileify
acbb349e 92
93# and pathifying them
0e9538e6 94__down_:[__the_.__garden_]__path_.dir;1 pathify __down_:[__the_.__garden_.__path_]
95[.__down_.__the_.__garden_]__path_.dir pathify [.__down_.__the_.__garden_.__path_]
96/__down_/__the_/__garden_/__path_.dir pathify /__down_/__the_/__garden_/__path_/
97__down_/__the_/__garden_/__path_.dir pathify __down_/__the_/__garden_/__path_/
98__down_:[__the_.__garden_]__path_ pathify __down_:[__the_.__garden_.__path_]
99__down_:[__the_.__garden_]__path_. pathify # N.B. trailing . ==> null type
100__down_:[__the_]__garden_.__path_ pathify
101/__down_/__the_/__garden_/__path_. pathify # N.B. trailing . ==> null type
102/__down_/__the_/__garden_.__path_ pathify
103__down_:[__the_.__garden_]__path_.dir;2 pathify #N.B. ;2
104__path_ pathify __path_/
105/__down_/__the_/__garden_/. pathify /__down_/__the_/__garden_/./
106/__down_/__the_/__garden_/.. pathify /__down_/__the_/__garden_/../
107/__down_/__the_/__garden_/... pathify /__down_/__the_/__garden_/.../
108__path_.notdir pathify
acbb349e 109
110# Both VMS/Unix and file/path conversions
0e9538e6 111__down_:[__the_.__garden_]__path_.dir;1 unixpath /__down_/__the_/__garden_/__path_/
112/__down_/__the_/__garden_/__path_ vmspath __down_:[__the_.__garden_.__path_]
113__down_:[__the_.__garden_.__path_] unixpath /__down_/__the_/__garden_/__path_/
114__down_:[__the_.__garden_.__path_...] unixpath /__down_/__the_/__garden_/__path_/.../
115/__down_/__the_/__garden_/__path_.dir vmspath __down_:[__the_.__garden_.__path_]
116[.__down_.__the_.__garden_]__path_.dir unixpath __down_/__the_/__garden_/__path_/
117__down_/__the_/__garden_/__path_ vmspath [.__down_.__the_.__garden_.__path_]
118__path_ vmspath [.__path_]
491527d0 119/ vmspath sys$disk:[000000]
acbb349e 120
121# Redundant characters in Unix paths
0e9538e6 122//__some_/__where_//__over_/../__the_.__rainbow_ vmsify __some_:[__where_]__the_.__rainbow_
123/__some_/__where_//__over_/./__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_
acbb349e 124..//../ vmspath [--]
125./././ vmspath []
126./../. vmsify [-]
0e9538e6 127
128# Our override of File::Spec->canonpath can do some strange things
129__dev:[__dir.000000]__foo File::Spec->canonpath __dev:[__dir]__foo
130__dev:[__dir.][000000]__foo File::Spec->canonpath __dev:[__dir]__foo