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