3 BEGIN { unshift(@INC,'../lib') if -d '../lib'; }
16 plan(tests => scalar(2*@tests)+6);
18 foreach $test (@tests) {
19 ($arg,$func,$expect) = split(/\s+/,$test);
21 $expect = undef if $expect eq 'undef';
22 $rslt = eval "$func('$arg')";
23 is($@, '', "eval ${func}('$arg')");
24 is(lc($rslt), lc($expect), "${func}('$arg'): '$rslt'");
28 # Note: This failure may have occurred because your default device
29 # was set using a non-concealed logical name. If this is the case,
30 # you will need to determine by inspection that the two resultant
31 # file specifications shown above are in fact equivalent.
34 is(uc(rmsexpand('[]')), "\U$ENV{DEFAULT}", 'rmsexpand()') || print $defwarn;
35 is(lc(rmsexpand('from.here')),"\L$ENV{DEFAULT}from.here") || print $defwarn;
36 is(lc(rmsexpand('from')), "\L$ENV{DEFAULT}from") || print $defwarn;
38 is(lc(rmsexpand('from.here','cant:[get.there];2')),
39 'cant:[get.there]from.here;2') || print $defwarn;
42 # Make sure we're using redirected mkdir, which strips trailing '/', since
43 # the CRTL's mkdir can't handle this.
44 ok(mkdir('testdir/',0777), 'using redirected mkdir()');
45 ok(rmdir('testdir/'), ' rmdir()');
49 # lots of underscores used to minimize collision with existing logical names
51 # Basic VMS to Unix filespecs
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_
55 [.__some_.--.__where_.__over_]__the_.__rainbow_ unixify __some_/../../__where_/__over_/__the_.__rainbow_
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_...]__the_.__rainbow_ unixify __some_/__where_/__over_/.../__the_.__rainbow_
59 [.__some_.__where_.__over_...] unixify __some_/__where_/__over_/.../
60 [.__some_.__where_.__over_.-] unixify __some_/__where_/__over_/../
65 __lyrics_:[__are_.__very_^.__sappy_]__but_^.__rhymes_^.__are_.__true_ unixify /__lyrics_/__are_/__very_.__sappy_/__but_.__rhymes_.__are_.__true_
68 /__some_/__where_/__over_/__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_
69 __some_/__where_/__over_/__the_.__rainbow_ vmsify [.__some_.__where_.__over_]__the_.__rainbow_
70 ../__some_/__where_/__over_/__the_.__rainbow_ vmsify [-.__some_.__where_.__over_]__the_.__rainbow_
71 __some_/../../__where_/__over_/__the_.__rainbow_ vmsify [-.__where_.__over_]__the_.__rainbow_
72 .../__some_/__where_/__over_/__the_.__rainbow_ vmsify [...__some_.__where_.__over_]__the_.__rainbow_
73 __some_/.../__where_/__over_/__the_.__rainbow_ vmsify [.__some_...__where_.__over_]__the_.__rainbow_
74 /__some_/.../__where_/__over_/__the_.__rainbow_ vmsify __some_:[...__where_.__over_]__the_.__rainbow_
75 __some_/__where_/... vmsify [.__some_.__where_...]
76 /__where_/... vmsify __where_:[...]
81 / vmsify sys$disk:[000000]
83 # Fileifying directory specs
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 __down_/__the_/__garden_/__path_.dir;1
89 __down_:[__the_.__garden_]__path_ fileify __down_:[__the_.__garden_]__path_.dir;1
90 __down_:[__the_.__garden_]__path_. fileify # N.B. trailing . ==> null type
91 __down_:[__the_]__garden_.__path_ fileify undef
92 /__down_/__the_/__garden_/__path_. fileify # N.B. trailing . ==> null type
93 /__down_/__the_/__garden_.__path_ fileify undef
96 __down_:[__the_.__garden_]__path_.dir;1 pathify __down_:[__the_.__garden_.__path_]
97 [.__down_.__the_.__garden_]__path_.dir pathify [.__down_.__the_.__garden_.__path_]
98 /__down_/__the_/__garden_/__path_.dir pathify /__down_/__the_/__garden_/__path_/
99 __down_/__the_/__garden_/__path_.dir pathify __down_/__the_/__garden_/__path_/
100 __down_:[__the_.__garden_]__path_ pathify __down_:[__the_.__garden_.__path_]
101 __down_:[__the_.__garden_]__path_. pathify # N.B. trailing . ==> null type
102 __down_:[__the_]__garden_.__path_ pathify undef
103 /__down_/__the_/__garden_/__path_. pathify # N.B. trailing . ==> null type
104 /__down_/__the_/__garden_.__path_ pathify undef
105 __down_:[__the_.__garden_]__path_.dir;2 pathify #N.B. ;2
106 __path_ pathify __path_/
107 /__down_/__the_/__garden_/. pathify /__down_/__the_/__garden_/./
108 /__down_/__the_/__garden_/.. pathify /__down_/__the_/__garden_/../
109 /__down_/__the_/__garden_/... pathify /__down_/__the_/__garden_/.../
110 __path_.notdir pathify undef
112 # Both VMS/Unix and file/path conversions
113 __down_:[__the_.__garden_]__path_.dir;1 unixpath /__down_/__the_/__garden_/__path_/
114 /__down_/__the_/__garden_/__path_ vmspath __down_:[__the_.__garden_.__path_]
115 __down_:[__the_.__garden_.__path_] unixpath /__down_/__the_/__garden_/__path_/
116 __down_:[__the_.__garden_.__path_...] unixpath /__down_/__the_/__garden_/__path_/.../
117 /__down_/__the_/__garden_/__path_.dir vmspath __down_:[__the_.__garden_.__path_]
118 [.__down_.__the_.__garden_]__path_.dir unixpath __down_/__the_/__garden_/__path_/
119 __down_/__the_/__garden_/__path_ vmspath [.__down_.__the_.__garden_.__path_]
120 __path_ vmspath [.__path_]
121 / vmspath sys$disk:[000000]
123 # Redundant characters in Unix paths
124 //__some_/__where_//__over_/../__the_.__rainbow_ vmsify __some_:[__where_]__the_.__rainbow_
125 /__some_/__where_//__over_/./__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_
130 # Our override of File::Spec->canonpath can do some strange things
131 __dev:[__dir.000000]__foo File::Spec->canonpath __dev:[__dir.000000]__foo
132 __dev:[__dir.][000000]__foo File::Spec->canonpath __dev:[__dir]__foo