1#!/usr/bin/perl -w 2 3use strict; 4use Test::More; 5 6require_ok('File::Spec'); 7 8require Cwd; 9 10my $vms_unix_rpt; 11 12if ($^O eq 'VMS') { 13 if (eval 'require VMS::Feature') { 14 $vms_unix_rpt = VMS::Feature::current("filename_unix_report"); 15 } else { 16 my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || ''; 17 $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i; 18 } 19} 20 21 22my $skip_exception = "Needs VMS::Filespec (and thus VMS)" ; 23 24eval { 25 require VMS::Filespec ; 26} ; 27 28if ( $@ ) { 29 # Not pretty, but it allows testing of things not implemented solely 30 # on VMS. It might be better to change File::Spec::VMS to do this, 31 # making it more usable when running on (say) Unix but working with 32 # VMS paths. 33 eval qq- 34 sub File::Spec::VMS::vmsify { die "$skip_exception" } 35 sub File::Spec::VMS::unixify { die "$skip_exception" } 36 sub File::Spec::VMS::vmspath { die "$skip_exception" } 37 - ; 38 $INC{"VMS/Filespec.pm"} = 1 ; 39} 40 41foreach (qw(Unix Win32 VMS OS2 Mac Epoc Cygwin)) { 42 require_ok("File::Spec::$_"); 43} 44 45# Each element in this array is a single test. Storing them this way makes 46# maintenance easy, and should be OK since perl should be pretty functional 47# before these tests are run. 48 49my @tests = ( 50# [ Function , Expected , Platform ] 51 52[ "Unix->case_tolerant()", '0' ], 53 54[ "Unix->catfile('a','b','c')", 'a/b/c' ], 55[ "Unix->catfile('a','b','./c')", 'a/b/c' ], 56[ "Unix->catfile('./a','b','c')", 'a/b/c' ], 57[ "Unix->catfile('c')", 'c' ], 58[ "Unix->catfile('./c')", 'c' ], 59[ "Unix->catfile('a', 'b'.chr(0xaf))", 'a/b'.chr(0xaf) ], 60($] >= 5.008 ? ( 61[ "Unix->catfile('a', do { my \$x = 'b'.chr(0xaf); use utf8 (); utf8::upgrade(\$x); \$x })", 'a/b'.chr(0xaf) ], 62) : ()), 63[ "Unix->catfile(substr('foo', 2))", 'o' ], 64 65[ "Unix->splitpath('file')", ',,file' ], 66[ "Unix->splitpath('/d1/d2/d3/')", ',/d1/d2/d3/,' ], 67[ "Unix->splitpath('d1/d2/d3/')", ',d1/d2/d3/,' ], 68[ "Unix->splitpath('/d1/d2/d3/.')", ',/d1/d2/d3/.,' ], 69[ "Unix->splitpath('/d1/d2/d3/..')", ',/d1/d2/d3/..,' ], 70[ "Unix->splitpath('/d1/d2/d3/.file')", ',/d1/d2/d3/,.file' ], 71[ "Unix->splitpath('d1/d2/d3/file')", ',d1/d2/d3/,file' ], 72[ "Unix->splitpath('/../../d1/')", ',/../../d1/,' ], 73[ "Unix->splitpath('/././d1/')", ',/././d1/,' ], 74 75[ "Unix->catpath('','','file')", 'file' ], 76[ "Unix->catpath('','/d1/d2/d3/','')", '/d1/d2/d3/' ], 77[ "Unix->catpath('','d1/d2/d3/','')", 'd1/d2/d3/' ], 78[ "Unix->catpath('','/d1/d2/d3/.','')", '/d1/d2/d3/.' ], 79[ "Unix->catpath('','/d1/d2/d3/..','')", '/d1/d2/d3/..' ], 80[ "Unix->catpath('','/d1/d2/d3/','.file')", '/d1/d2/d3/.file' ], 81[ "Unix->catpath('','d1/d2/d3/','file')", 'd1/d2/d3/file' ], 82[ "Unix->catpath('','/../../d1/','')", '/../../d1/' ], 83[ "Unix->catpath('','/././d1/','')", '/././d1/' ], 84[ "Unix->catpath('d1','d2/d3/','')", 'd2/d3/' ], 85[ "Unix->catpath('d1','d2','d3/')", 'd2/d3/' ], 86 87[ "Unix->splitdir('')", '' ], 88[ "Unix->splitdir('/d1/d2/d3/')", ',d1,d2,d3,' ], 89[ "Unix->splitdir('d1/d2/d3/')", 'd1,d2,d3,' ], 90[ "Unix->splitdir('/d1/d2/d3')", ',d1,d2,d3' ], 91[ "Unix->splitdir('d1/d2/d3')", 'd1,d2,d3' ], 92 93[ "Unix->catdir()", '' ], 94[ "Unix->catdir('')", '/' ], 95[ "Unix->catdir('/')", '/' ], 96[ "Unix->catdir('','d1','d2','d3','')", '/d1/d2/d3' ], 97[ "Unix->catdir('d1','d2','d3','')", 'd1/d2/d3' ], 98[ "Unix->catdir('','d1','d2','d3')", '/d1/d2/d3' ], 99[ "Unix->catdir('d1','d2','d3')", 'd1/d2/d3' ], 100# QNX is POSIXly special 101[ "Unix->catdir('/','d2/d3')", ( $^O =~ m!^(nto|qnx)! ? '//d2/d3' : '/d2/d3' ) ], 102[ "Unix->catdir('a', 'b'.chr(0xaf))", 'a/b'.chr(0xaf) ], 103($] >= 5.008 ? ( 104[ "Unix->catdir('a', do { my \$x = 'b'.chr(0xaf); use utf8 (); utf8::upgrade(\$x); \$x })", 'a/b'.chr(0xaf) ], 105) : ()), 106 107[ "Unix->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ], 108[ "Unix->canonpath('')", '' ], 109# rt.perl.org 27052 110[ "Unix->canonpath('a/../../b/c')", 'a/../../b/c' ], 111[ "Unix->canonpath('/')", '/' ], 112[ "Unix->canonpath('///')", '/' ], 113[ "Unix->canonpath('/.')", '/' ], 114[ "Unix->canonpath('/./')", '/' ], 115[ "Unix->canonpath('///.')", '/' ], 116[ "Unix->canonpath('///.///')", '/' ], 117[ "Unix->canonpath('///..')", '/' ], 118[ "Unix->canonpath('///..///')", '/' ], 119[ "Unix->canonpath('///..///.///..///')", '/' ], 120[ "Unix->canonpath('.')", '.' ], 121[ "Unix->canonpath('.///')", '.' ], 122[ "Unix->canonpath('.///.')", '.' ], 123[ "Unix->canonpath('.///.///')", '.' ], 124[ "Unix->canonpath('..')", '..' ], 125[ "Unix->canonpath('..///')", '..' ], 126[ "Unix->canonpath('../..')", '../..' ], 127[ "Unix->canonpath('../../')", '../..' ], 128[ "Unix->canonpath('..///.///..///')", '../..' ], 129[ "Unix->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ], 130[ "Unix->canonpath('a/../../b/c')", 'a/../../b/c' ], 131[ "Unix->canonpath('a///..///..///b////c')", 'a/../../b/c' ], 132[ "Unix->canonpath('.///a///.///..///.///..///.///b///.////c///.')", 'a/../../b/c' ], 133[ "Unix->canonpath('/a/./')", '/a' ], 134[ "Unix->canonpath('/a/.')", '/a' ], 135[ "Unix->canonpath('/../../')", '/' ], 136[ "Unix->canonpath('/../..')", '/' ], 137[ "Unix->canonpath('/foo', '/bar')", '/foo' ], 138[ "Unix->canonpath('///a'.chr(0xaf))", '/a'.chr(0xaf) ], 139($] >= 5.008 ? ( 140[ "Unix->canonpath(do { my \$x = '///a'.chr(0xaf); use utf8 (); utf8::upgrade(\$x); \$x })", '/a'.chr(0xaf) ], 141) : ()), 142 143[ "Unix->abs2rel('/t1/t2/t3','/t1/t2/t3')", '.' ], 144[ "Unix->abs2rel('/t1/t2/t4','/t1/t2/t3')", '../t4' ], 145[ "Unix->abs2rel('/t1/t2','/t1/t2/t3')", '..' ], 146[ "Unix->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')", 't4' ], 147[ "Unix->abs2rel('/t4/t5/t6','/t1/t2/t3')", '../../../t4/t5/t6' ], 148#[ "Unix->abs2rel('../t4','/t1/t2/t3')", '../t4' ], 149[ "Unix->abs2rel('/','/t1/t2/t3')", '../../..' ], 150[ "Unix->abs2rel('///','/t1/t2/t3')", '../../..' ], 151[ "Unix->abs2rel('/.','/t1/t2/t3')", '../../..' ], 152[ "Unix->abs2rel('/./','/t1/t2/t3')", '../../..' ], 153#[ "Unix->abs2rel('../t4','/t1/t2/t3')", '../t4' ], 154[ "Unix->abs2rel('/t1/t2/t3', '/')", 't1/t2/t3' ], 155[ "Unix->abs2rel('/t1/t2/t3', '/t1')", 't2/t3' ], 156[ "Unix->abs2rel('t1/t2/t3', 't1')", 't2/t3' ], 157[ "Unix->abs2rel('t1/t2/t3', 't4')", '../t1/t2/t3' ], 158 [ "Unix->abs2rel('.', '.')", '.' ], 159 [ "Unix->abs2rel('/', '/')", '.' ], 160 [ "Unix->abs2rel('../t1', 't2/t3')", '../../../t1' ], 161 [ "Unix->abs2rel('t1', 't2/../t3')", '../t1' ], 162 163[ "Unix->rel2abs('t4','/t1/t2/t3')", '/t1/t2/t3/t4' ], 164[ "Unix->rel2abs('t4/t5','/t1/t2/t3')", '/t1/t2/t3/t4/t5' ], 165[ "Unix->rel2abs('.','/t1/t2/t3')", '/t1/t2/t3' ], 166[ "Unix->rel2abs('..','/t1/t2/t3')", '/t1/t2/t3/..' ], 167[ "Unix->rel2abs('../t4','/t1/t2/t3')", '/t1/t2/t3/../t4' ], 168[ "Unix->rel2abs('/t1','/t1/t2/t3')", '/t1' ], 169 170[ "Win32->case_tolerant()", '1' ], 171[ "Win32->rootdir()", '\\' ], 172 173[ "Win32->splitpath('file')", ',,file' ], 174[ "Win32->splitpath('\\d1/d2\\d3/')", ',\\d1/d2\\d3/,' ], 175[ "Win32->splitpath('d1/d2\\d3/')", ',d1/d2\\d3/,' ], 176[ "Win32->splitpath('\\d1/d2\\d3/.')", ',\\d1/d2\\d3/.,' ], 177[ "Win32->splitpath('\\d1/d2\\d3/..')", ',\\d1/d2\\d3/..,' ], 178[ "Win32->splitpath('\\d1/d2\\d3/.file')", ',\\d1/d2\\d3/,.file' ], 179[ "Win32->splitpath('\\d1/d2\\d3/file')", ',\\d1/d2\\d3/,file' ], 180[ "Win32->splitpath('d1/d2\\d3/file')", ',d1/d2\\d3/,file' ], 181[ "Win32->splitpath('C:\\d1/d2\\d3/')", 'C:,\\d1/d2\\d3/,' ], 182[ "Win32->splitpath('C:d1/d2\\d3/')", 'C:,d1/d2\\d3/,' ], 183[ "Win32->splitpath('C:\\d1/d2\\d3/file')", 'C:,\\d1/d2\\d3/,file' ], 184[ "Win32->splitpath('C:d1/d2\\d3/file')", 'C:,d1/d2\\d3/,file' ], 185[ "Win32->splitpath('C:\\../d2\\d3/file')", 'C:,\\../d2\\d3/,file' ], 186[ "Win32->splitpath('C:../d2\\d3/file')", 'C:,../d2\\d3/,file' ], 187[ "Win32->splitpath('\\../..\\d1/')", ',\\../..\\d1/,' ], 188[ "Win32->splitpath('\\./.\\d1/')", ',\\./.\\d1/,' ], 189[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/')", '\\\\node\\share,\\d1/d2\\d3/,' ], 190[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/file')", '\\\\node\\share,\\d1/d2\\d3/,file' ], 191[ "Win32->splitpath('\\\\node\\share\\d1/d2\\file')", '\\\\node\\share,\\d1/d2\\,file' ], 192[ "Win32->splitpath('file',1)", ',file,' ], 193[ "Win32->splitpath('\\d1/d2\\d3/',1)", ',\\d1/d2\\d3/,' ], 194[ "Win32->splitpath('d1/d2\\d3/',1)", ',d1/d2\\d3/,' ], 195[ "Win32->splitpath('\\\\node\\share\\d1/d2\\d3/',1)", '\\\\node\\share,\\d1/d2\\d3/,' ], 196 197[ "Win32->catpath('','','file')", 'file' ], 198[ "Win32->catpath('','\\d1/d2\\d3/','')", '\\d1/d2\\d3/' ], 199[ "Win32->catpath('','d1/d2\\d3/','')", 'd1/d2\\d3/' ], 200[ "Win32->catpath('','\\d1/d2\\d3/.','')", '\\d1/d2\\d3/.' ], 201[ "Win32->catpath('','\\d1/d2\\d3/..','')", '\\d1/d2\\d3/..' ], 202[ "Win32->catpath('','\\d1/d2\\d3/','.file')", '\\d1/d2\\d3/.file' ], 203[ "Win32->catpath('','\\d1/d2\\d3/','file')", '\\d1/d2\\d3/file' ], 204[ "Win32->catpath('','d1/d2\\d3/','file')", 'd1/d2\\d3/file' ], 205[ "Win32->catpath('C:','\\d1/d2\\d3/','')", 'C:\\d1/d2\\d3/' ], 206[ "Win32->catpath('C:','d1/d2\\d3/','')", 'C:d1/d2\\d3/' ], 207[ "Win32->catpath('C:','\\d1/d2\\d3/','file')", 'C:\\d1/d2\\d3/file' ], 208[ "Win32->catpath('C:','d1/d2\\d3/','file')", 'C:d1/d2\\d3/file' ], 209[ "Win32->catpath('C:','\\../d2\\d3/','file')", 'C:\\../d2\\d3/file' ], 210[ "Win32->catpath('C:','../d2\\d3/','file')", 'C:../d2\\d3/file' ], 211[ "Win32->catpath('','\\../..\\d1/','')", '\\../..\\d1/' ], 212[ "Win32->catpath('','\\./.\\d1/','')", '\\./.\\d1/' ], 213[ "Win32->catpath('\\\\node\\share','\\d1/d2\\d3/','')", '\\\\node\\share\\d1/d2\\d3/' ], 214[ "Win32->catpath('\\\\node\\share','\\d1/d2\\d3/','file')", '\\\\node\\share\\d1/d2\\d3/file' ], 215[ "Win32->catpath('\\\\node\\share','\\d1/d2\\','file')", '\\\\node\\share\\d1/d2\\file' ], 216 217[ "Win32->splitdir('')", '' ], 218[ "Win32->splitdir('\\d1/d2\\d3/')", ',d1,d2,d3,' ], 219[ "Win32->splitdir('d1/d2\\d3/')", 'd1,d2,d3,' ], 220[ "Win32->splitdir('\\d1/d2\\d3')", ',d1,d2,d3' ], 221[ "Win32->splitdir('d1/d2\\d3')", 'd1,d2,d3' ], 222 223[ "Win32->catdir()", '' ], 224[ "Win32->catdir('')", '\\' ], 225[ "Win32->catdir('/')", '\\' ], 226[ "Win32->catdir('/', '../')", '\\' ], 227[ "Win32->catdir('/', '..\\')", '\\' ], 228[ "Win32->catdir('\\', '../')", '\\' ], 229[ "Win32->catdir('\\', '..\\')", '\\' ], 230[ "Win32->catdir('//d1','d2')", '\\\\d1\\d2' ], 231[ "Win32->catdir('\\d1\\','d2')", '\\d1\\d2' ], 232[ "Win32->catdir('\\d1','d2')", '\\d1\\d2' ], 233[ "Win32->catdir('\\d1','\\d2')", '\\d1\\d2' ], 234[ "Win32->catdir('\\d1','\\d2\\')", '\\d1\\d2' ], 235[ "Win32->catdir('','/d1','d2')", '\\d1\\d2' ], 236[ "Win32->catdir('','','/d1','d2')", '\\d1\\d2' ], 237[ "Win32->catdir('','//d1','d2')", '\\d1\\d2' ], 238[ "Win32->catdir('','','//d1','d2')", '\\d1\\d2' ], 239[ "Win32->catdir('','d1','','d2','')", '\\d1\\d2' ], 240[ "Win32->catdir('','d1','d2','d3','')", '\\d1\\d2\\d3' ], 241[ "Win32->catdir('d1','d2','d3','')", 'd1\\d2\\d3' ], 242[ "Win32->catdir('','d1','d2','d3')", '\\d1\\d2\\d3' ], 243[ "Win32->catdir('d1','d2','d3')", 'd1\\d2\\d3' ], 244[ "Win32->catdir('A:/d1','d2','d3')", 'A:\\d1\\d2\\d3' ], 245[ "Win32->catdir('A:/d1','d2','d3','')", 'A:\\d1\\d2\\d3' ], 246#[ "Win32->catdir('A:/d1','B:/d2','d3','')", 'A:\\d1\\d2\\d3' ], 247[ "Win32->catdir('A:/d1','B:/d2','d3','')", 'A:\\d1\\B:\\d2\\d3' ], 248[ "Win32->catdir('A:/')", 'A:\\' ], 249[ "Win32->catdir('\\', 'foo')", '\\foo' ], 250[ "Win32->catdir('','','..')", '\\' ], 251[ "Win32->catdir('A:', 'foo')", 'A:\\foo' ], 252 253[ "Win32->catfile('a','b','c')", 'a\\b\\c' ], 254[ "Win32->catfile('a','b','.\\c')", 'a\\b\\c' ], 255[ "Win32->catfile('.\\a','b','c')", 'a\\b\\c' ], 256[ "Win32->catfile('c')", 'c' ], 257[ "Win32->catfile('.\\c')", 'c' ], 258[ "Win32->catfile('a/..','../b')", '..\\b' ], 259[ "Win32->catfile('A:', 'foo')", 'A:\\foo' ], 260 261 262[ "Win32->canonpath('')", '' ], 263[ "Win32->canonpath('a:')", 'A:' ], 264[ "Win32->canonpath('A:f')", 'A:f' ], 265[ "Win32->canonpath('A:/')", 'A:\\' ], 266# rt.perl.org 27052 267[ "Win32->canonpath('a\\..\\..\\b\\c')", '..\\b\\c' ], 268[ "Win32->canonpath('//a\\b//c')", '\\\\a\\b\\c' ], 269[ "Win32->canonpath('/a/..../c')", '\\a\\....\\c' ], 270[ "Win32->canonpath('//a/b\\c')", '\\\\a\\b\\c' ], 271[ "Win32->canonpath('////')", '\\' ], 272[ "Win32->canonpath('//')", '\\' ], 273[ "Win32->canonpath('/.')", '\\' ], 274[ "Win32->canonpath('//a/b/../../c')", '\\\\a\\b\\c' ], 275[ "Win32->canonpath('//a/b/c/../d')", '\\\\a\\b\\d' ], 276[ "Win32->canonpath('//a/b/c/../../d')",'\\\\a\\b\\d' ], 277[ "Win32->canonpath('//a/b/c/.../d')", '\\\\a\\b\\d' ], 278[ "Win32->canonpath('/a/b/c/../../d')", '\\a\\d' ], 279[ "Win32->canonpath('/a/b/c/.../d')", '\\a\\d' ], 280[ "Win32->canonpath('\\../temp\\')", '\\temp' ], 281[ "Win32->canonpath('\\../')", '\\' ], 282[ "Win32->canonpath('\\..\\')", '\\' ], 283[ "Win32->canonpath('/../')", '\\' ], 284[ "Win32->canonpath('/..\\')", '\\' ], 285[ "Win32->canonpath('d1/../foo')", 'foo' ], 286 287# FakeWin32 subclass (see below) just sets CWD to C:\one\two and getdcwd('D') to D:\alpha\beta 288 289[ "FakeWin32->abs2rel('/t1/t2/t3','/t1/t2/t3')", '.' ], 290[ "FakeWin32->abs2rel('/t1/t2/t4','/t1/t2/t3')", '..\\t4' ], 291[ "FakeWin32->abs2rel('/t1/t2','/t1/t2/t3')", '..' ], 292[ "FakeWin32->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')", 't4' ], 293[ "FakeWin32->abs2rel('/t4/t5/t6','/t1/t2/t3')", '..\\..\\..\\t4\\t5\\t6' ], 294[ "FakeWin32->abs2rel('../t4','/t1/t2/t3')", '..\\..\\..\\one\\t4' ], # Uses _cwd() 295[ "FakeWin32->abs2rel('/','/t1/t2/t3')", '..\\..\\..' ], 296[ "FakeWin32->abs2rel('///','/t1/t2/t3')", '..\\..\\..' ], 297[ "FakeWin32->abs2rel('/.','/t1/t2/t3')", '..\\..\\..' ], 298[ "FakeWin32->abs2rel('/./','/t1/t2/t3')", '..\\..\\..' ], 299[ "FakeWin32->abs2rel('\\\\a/t1/t2/t4','/t2/t3')", '\\\\a\\t1\\t2\\t4' ], 300[ "FakeWin32->abs2rel('//a/t1/t2/t4','/t2/t3')", '\\\\a\\t1\\t2\\t4' ], 301[ "FakeWin32->abs2rel('A:/t1/t2/t3','A:/t1/t2/t3')", '.' ], 302[ "FakeWin32->abs2rel('A:/t1/t2/t3/t4','A:/t1/t2/t3')", 't4' ], 303[ "FakeWin32->abs2rel('A:/t1/t2/t3','A:/t1/t2/t3/t4')", '..' ], 304[ "FakeWin32->abs2rel('A:/t1/t2/t3','B:/t1/t2/t3')", 'A:\\t1\\t2\\t3' ], 305[ "FakeWin32->abs2rel('A:/t1/t2/t3/t4','B:/t1/t2/t3')", 'A:\\t1\\t2\\t3\\t4' ], 306[ "FakeWin32->abs2rel('E:/foo/bar/baz')", 'E:\\foo\\bar\\baz' ], 307[ "FakeWin32->abs2rel('C:/one/two/three')", 'three' ], 308[ "FakeWin32->abs2rel('C:\\Windows\\System32', 'C:\\')", 'Windows\System32' ], 309[ "FakeWin32->abs2rel('\\\\computer2\\share3\\foo.txt', '\\\\computer2\\share3')", 'foo.txt' ], 310[ "FakeWin32->abs2rel('C:\\one\\two\\t\\asd1\\', 't\\asd\\')", '..\\asd1' ], 311[ "FakeWin32->abs2rel('\\one\\two', 'A:\\foo')", 'C:\\one\\two' ], 312 313[ "FakeWin32->rel2abs('temp','C:/')", 'C:\\temp' ], 314[ "FakeWin32->rel2abs('temp','C:/a')", 'C:\\a\\temp' ], 315[ "FakeWin32->rel2abs('temp','C:/a/')", 'C:\\a\\temp' ], 316[ "FakeWin32->rel2abs('../','C:/')", 'C:\\' ], 317[ "FakeWin32->rel2abs('../','C:/a')", 'C:\\' ], 318[ "FakeWin32->rel2abs('\\foo','C:/a')", 'C:\\foo' ], 319[ "FakeWin32->rel2abs('temp','//prague_main/work/')", '\\\\prague_main\\work\\temp' ], 320[ "FakeWin32->rel2abs('../temp','//prague_main/work/')", '\\\\prague_main\\work\\temp' ], 321[ "FakeWin32->rel2abs('temp','//prague_main/work')", '\\\\prague_main\\work\\temp' ], 322[ "FakeWin32->rel2abs('../','//prague_main/work')", '\\\\prague_main\\work' ], 323[ "FakeWin32->rel2abs('D:foo.txt')", 'D:\\alpha\\beta\\foo.txt' ], 324 325[ "VMS->case_tolerant()", '1' ], 326 327[ "VMS->catfile('a','b','c')", $vms_unix_rpt ? 'a/b/c' : '[.a.b]c' ], 328[ "VMS->catfile('a','b','[]c')", $vms_unix_rpt ? 'a/b/c' : '[.a.b]c' ], 329[ "VMS->catfile('[.a]','b','c')", $vms_unix_rpt ? 'a/b/c' : '[.a.b]c' ], 330[ "VMS->catfile('a/b/','c')", $vms_unix_rpt ? 'a/b/c' : '[.a.b]c' ], 331[ "VMS->catfile('c')", 'c' ], 332[ "VMS->catfile('[]c')", 'c' ], 333 334[ "VMS->catfile('0','b','c')", $vms_unix_rpt ? '0/b/c' : '[.0.b]c' ], 335[ "VMS->catfile('a','0','c')", $vms_unix_rpt ? 'a/0/c' : '[.a.0]c' ], 336[ "VMS->catfile('a','b','0')", $vms_unix_rpt ? 'a/b/0' : '[.a.b]0' ], 337[ "VMS->catfile('0','0','c')", $vms_unix_rpt ? '0/0/c' : '[.0.0]c' ], 338[ "VMS->catfile('a','0','0')", $vms_unix_rpt ? 'a/0/0' : '[.a.0]0' ], 339[ "VMS->catfile('0','b','0')", $vms_unix_rpt ? '0/b/0' : '[.0.b]0' ], 340[ "VMS->catfile('0','0','0')", $vms_unix_rpt ? '0/0/0' : '[.0.0]0' ], 341 342 343[ "VMS->splitpath('file')", ',,file' ], 344[ "VMS->splitpath('[d1.d2.d3]')", ',[d1.d2.d3],' ], 345[ "VMS->splitpath('[.d1.d2.d3]')", ',[.d1.d2.d3],' ], 346[ "VMS->splitpath('[d1.d2.d3]file')", ',[d1.d2.d3],file' ], 347[ "VMS->splitpath('d1/d2/d3/file')", 348 $vms_unix_rpt ? ',d1/d2/d3/,file' : ',[.d1.d2.d3],file' ], 349[ "VMS->splitpath('/d1/d2/d3/file')", 350 $vms_unix_rpt ? ',/d1/d2/d3/,file' : 'd1:,[d2.d3],file' ], 351[ "VMS->splitpath('[.d1.d2.d3]file')", ',[.d1.d2.d3],file' ], 352[ "VMS->splitpath('node::volume:[d1.d2.d3]')", 'node::volume:,[d1.d2.d3],' ], 353[ "VMS->splitpath('node::volume:[d1.d2.d3]file')", 'node::volume:,[d1.d2.d3],file' ], 354[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]')", 'node"access_spec"::volume:,[d1.d2.d3],' ], 355[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]file')", 'node"access_spec"::volume:,[d1.d2.d3],file' ], 356 357[ "VMS->splitpath('[]')", ',[],' ], 358[ "VMS->splitpath('[-]')", ',[-],' ], 359[ "VMS->splitpath('[]file')", ',[],file' ], 360[ "VMS->splitpath('[-]file')", ',[-],file' ], 361[ "VMS->splitpath('')", ',,' ], 362[ "VMS->splitpath('0')", ',,0' ], 363[ "VMS->splitpath('[0]')", ',[0],' ], 364[ "VMS->splitpath('[.0]')", ',[.0],' ], 365[ "VMS->splitpath('[0.0.0]')", ',[0.0.0],' ], 366[ "VMS->splitpath('[.0.0.0]')", ',[.0.0.0],' ], 367[ "VMS->splitpath('[0]0')", ',[0],0' ], 368[ "VMS->splitpath('[0.0.0]0')", ',[0.0.0],0' ], 369[ "VMS->splitpath('[.0.0.0]0')", ',[.0.0.0],0' ], 370[ "VMS->splitpath('0/0')", $vms_unix_rpt ? ',0/,0' : ',[.0],0' ], 371[ "VMS->splitpath('0/0/0')", $vms_unix_rpt ? ',0/0/,0' : ',[.0.0],0' ], 372[ "VMS->splitpath('/0/0')", $vms_unix_rpt ? ',/0/,0' : '0:,[000000],0' ], 373[ "VMS->splitpath('/0/0/0')", $vms_unix_rpt ? ',/0/0/,0' : '0:,[0],0' ], 374[ "VMS->splitpath('d1',1)", ',d1,' ], 375# $no_file tests 376[ "VMS->splitpath('[d1.d2.d3]',1)", ',[d1.d2.d3],' ], 377[ "VMS->splitpath('[.d1.d2.d3]',1)", ',[.d1.d2.d3],' ], 378[ "VMS->splitpath('d1/d2/d3',1)", $vms_unix_rpt ? ',d1/d2/d3,' : ',[.d1.d2.d3],' ], 379[ "VMS->splitpath('/d1/d2/d3',1)", $vms_unix_rpt ? ',/d1/d2/d3,' : 'd1:,[d2.d3],' ], 380[ "VMS->splitpath('node::volume:[d1.d2.d3]',1)", 'node::volume:,[d1.d2.d3],' ], 381[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]',1)", 'node"access_spec"::volume:,[d1.d2.d3],' ], 382[ "VMS->splitpath('[]',1)", ',[],' ], 383[ "VMS->splitpath('[-]',1)", ',[-],' ], 384[ "VMS->splitpath('',1)", ',,' ], 385[ "VMS->splitpath('0',1)", ',0,' ], 386[ "VMS->splitpath('[0]',1)", ',[0],' ], 387[ "VMS->splitpath('[.0]',1)", ',[.0],' ], 388[ "VMS->splitpath('[0.0.0]',1)", ',[0.0.0],' ], 389[ "VMS->splitpath('[.0.0.0]',1)", ',[.0.0.0],' ], 390[ "VMS->splitpath('0/0',1)", $vms_unix_rpt ? ',0/0,' : ',[.0.0],' ], 391[ "VMS->splitpath('0/0/0',1)", $vms_unix_rpt ? ',0/0/0,' : ',[.0.0.0],' ], 392[ "VMS->splitpath('/0/0',1)", $vms_unix_rpt ? ',/0/0,' : '0:,[000000.0],' ], 393[ "VMS->splitpath('/0/0/0',1)", $vms_unix_rpt ? ',/0/0/0,' : '0:,[0.0],' ], 394 395[ "VMS->catpath('','','file')", 'file' ], 396[ "VMS->catpath('','[d1.d2.d3]','')", '[d1.d2.d3]' ], 397[ "VMS->catpath('','[.d1.d2.d3]','')", '[.d1.d2.d3]' ], 398[ "VMS->catpath('','[d1.d2.d3]','file')", '[d1.d2.d3]file' ], 399[ "VMS->catpath('','[.d1.d2.d3]','file')", '[.d1.d2.d3]file' ], 400[ "VMS->catpath('','d1/d2/d3','file')", 401 $vms_unix_rpt ? 'd1/d2/d3/file' : '[.d1.d2.d3]file' ], 402[ "VMS->catpath('v','d1/d2/d3','file')", 'v:[.d1.d2.d3]file' ], 403[ "VMS->catpath('v','','file')", 'v:file' ], 404[ "VMS->catpath('v','w:[d1.d2.d3]','file')", 'v:[d1.d2.d3]file' ], 405[ "VMS->catpath('node::volume:','[d1.d2.d3]','')", 'node::volume:[d1.d2.d3]' ], 406[ "VMS->catpath('node::volume:','[d1.d2.d3]','file')", 'node::volume:[d1.d2.d3]file' ], 407[ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','')", 'node"access_spec"::volume:[d1.d2.d3]' ], 408[ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','file')", 'node"access_spec"::volume:[d1.d2.d3]file' ], 409 410[ "VMS->canonpath('')", '' ], 411[ "VMS->canonpath('volume:[d1]file')", $vms_unix_rpt ? '/volume/d1/file' : 'volume:[d1]file' ], 412[ "VMS->canonpath('volume:[d1.-.d2.][d3.d4.-]')", $vms_unix_rpt ? '/volume/d2/d3/' : 'volume:[d2.d3]' ], 413[ "VMS->canonpath('volume:[000000.d1]d2.dir;1')", $vms_unix_rpt ? '/volume/d1/d2.dir.1' : 'volume:[d1]d2.dir;1' ], 414[ "VMS->canonpath('volume:[d1.d2.d3]file.txt')", $vms_unix_rpt ? '/volume/d1/d2/d3/file.txt' : 'volume:[d1.d2.d3]file.txt' ], 415[ "VMS->canonpath('[d1.d2.d3]file.txt')", $vms_unix_rpt ? '/sys$disk/d1/d2/d3/file.txt' : '[d1.d2.d3]file.txt' ], 416[ "VMS->canonpath('volume:[-.d1.d2.d3]file.txt')", $vms_unix_rpt ? '/volume/../d1/d2/d3/file.txt' : 'volume:[-.d1.d2.d3]file.txt' ], 417[ "VMS->canonpath('[-.d1.d2.d3]file.txt')", $vms_unix_rpt ? '../d1/d2/d3/file.txt' : '[-.d1.d2.d3]file.txt' ], 418[ "VMS->canonpath('volume:[--.d1.d2.d3]file.txt')", $vms_unix_rpt ? '/volume/../../d1/d2/d3/file.txt' : 'volume:[--.d1.d2.d3]file.txt' ], 419[ "VMS->canonpath('[--.d1.d2.d3]file.txt')", $vms_unix_rpt ? '../../d1/d2/d3/file.txt' : '[--.d1.d2.d3]file.txt' ], 420[ "VMS->canonpath('volume:[d1.-.d2.d3]file.txt')", $vms_unix_rpt ? '/volume/d2/d3/file.txt' : 'volume:[d2.d3]file.txt' ], 421[ "VMS->canonpath('[d1.-.d2.d3]file.txt')", $vms_unix_rpt ? '/sys$disk/d2/d3/file.txt' : '[d2.d3]file.txt' ], 422[ "VMS->canonpath('volume:[d1.--.d2.d3]file.txt')", $vms_unix_rpt ? '/volume/../d2/d3/file.txt' : 'volume:[-.d2.d3]file.txt' ], 423[ "VMS->canonpath('[d1.--.d2.d3]file.txt')", $vms_unix_rpt ? '../d2/d3/file.txt' : '[-.d2.d3]file.txt' ], 424[ "VMS->canonpath('volume:[d1.d2.-.d3]file.txt')", $vms_unix_rpt ? '/volume/d1/d3/file.txt' : 'volume:[d1.d3]file.txt' ], 425[ "VMS->canonpath('[d1.d2.-.d3]file.txt')", $vms_unix_rpt ? '/sys$disk/d1/d3/file.txt' : '[d1.d3]file.txt' ], 426[ "VMS->canonpath('volume:[d1.d2.--.d3]file.txt')", $vms_unix_rpt ? '/volume/d3/file.txt' : 'volume:[d3]file.txt' ], 427[ "VMS->canonpath('[d1.d2.--.d3]file.txt')", $vms_unix_rpt ? '/sys$disk/d3/file.txt' : '[d3]file.txt' ], 428[ "VMS->canonpath('volume:[d1.d2.d3.-]file.txt')", $vms_unix_rpt ? '/volume/d1/d2/file.txt' : 'volume:[d1.d2]file.txt' ], 429[ "VMS->canonpath('[d1.d2.d3.-]file.txt')", $vms_unix_rpt ? '/sys$disk/d1/d2/file.txt' : '[d1.d2]file.txt' ], 430[ "VMS->canonpath('volume:[d1.d2.d3.--]file.txt')", $vms_unix_rpt ? '/volume/d1/file.txt' : 'volume:[d1]file.txt' ], 431[ "VMS->canonpath('[d1.d2.d3.--]file.txt')", $vms_unix_rpt ? '/sys$disk/d1/file.txt' : '[d1]file.txt' ], 432[ "VMS->canonpath('volume:[d1.000000.][000000.][d3.--]file.txt')", $vms_unix_rpt ? '/volume/d1/file.txt' 433 : 'volume:[d1]file.txt' ], 434[ "VMS->canonpath('[d1.000000.][000000.][d3.--]file.txt')", $vms_unix_rpt ? '/sys$disk/d1/file.txt' 435 : '[d1]file.txt' ], 436[ "VMS->canonpath('volume:[d1.000000.][000000.][d2.000000]file.txt')", $vms_unix_rpt ? '/volume/d1/000000/d2/000000/file.txt' 437 : 'volume:[d1.000000.d2.000000]file.txt' ], 438[ "VMS->canonpath('[d1.000000.][000000.][d2.000000]file.txt')", $vms_unix_rpt ? '/sys$disk/d1/000000/d2/000000/file.txt' 439 : '[d1.000000.d2.000000]file.txt' ], 440[ "VMS->canonpath('volume:[d1.000000.][000000.][d3.--.000000]file.txt')", $vms_unix_rpt ? '/volume/d1/000000/file.txt' 441 : 'volume:[d1.000000]file.txt' ], 442[ "VMS->canonpath('[d1.000000.][000000.][d3.--.000000]file.txt')", $vms_unix_rpt ? '/sys$disk/d1/000000/file.txt' 443 : '[d1.000000]file.txt' ], 444[ "VMS->canonpath('volume:[d1.000000.][000000.][-.-.000000]file.txt')", $vms_unix_rpt ? '/volume/file.txt' 445 : 'volume:[000000]file.txt' ], 446[ "VMS->canonpath('[d1.000000.][000000.][--.-.000000]file.txt')", $vms_unix_rpt ? '../file.txt' : '[-.000000]file.txt' ], 447[ "VMS->canonpath('[d1.d2.--]file')", $vms_unix_rpt ? '../file.txt' : '[000000]file' ], 448# During the Perl 5.8 era, FS::Unix stopped eliminating redundant path elements, so mimic that here. 449[ "VMS->canonpath('a/../../b/c.dat')", $vms_unix_rpt ? 'a/../../b/c.dat' : '[-.b]c.dat' ], 450[ "VMS->canonpath('^<test^.new.-.caret^ escapes^>')", '^<test^.new.-.caret^ escapes^>' ], 451 452[ "VMS->splitdir('')", '' ], 453[ "VMS->splitdir('[]')", '' ], 454[ "VMS->splitdir('d1.d2.d3')", 'd1,d2,d3' ], 455[ "VMS->splitdir('[d1.d2.d3]')", 'd1,d2,d3' ], 456[ "VMS->splitdir('.d1.d2.d3')", 'd1,d2,d3' ], 457[ "VMS->splitdir('[.d1.d2.d3]')", 'd1,d2,d3' ], 458[ "VMS->splitdir('.-.d2.d3')", '-,d2,d3' ], 459[ "VMS->splitdir('[.-.d2.d3]')", '-,d2,d3' ], 460[ "VMS->splitdir('[d1.d2]')", 'd1,d2' ], 461[ "VMS->splitdir('[d1-.--d2]')", 'd1-,--d2' ], 462[ "VMS->splitdir('[d1---.-.d2]')", 'd1---,-,d2' ], 463[ "VMS->splitdir('[d1.---.d2]')", 'd1,-,-,-,d2' ], 464[ "VMS->splitdir('[d1---d2]')", 'd1---d2' ], 465[ "VMS->splitdir('[d1.][000000.d2]')", 'd1,d2' ], 466[ "VMS->splitdir('[.d1.d2^.d3]')", 'd1,d2^.d3' ], 467 468[ "VMS->catdir('')", '' ], 469[ "VMS->catdir('foo')", $vms_unix_rpt ? 'foo' : '[.foo]' ], 470[ "VMS->catdir('d1','d2','d3')", $vms_unix_rpt ? 'd1/d2/d3' : '[.d1.d2.d3]' ], 471[ "VMS->catdir('d1','d2/','d3')", $vms_unix_rpt ? 'd1/d2/d3' : '[.d1.d2.d3]' ], 472[ "VMS->catdir('','d1','d2','d3')",$vms_unix_rpt ? '/d1/d2/d3' : '[.d1.d2.d3]' ], 473[ "VMS->catdir('','-','d2','d3')", $vms_unix_rpt ? '-/d2/d3' : '[-.d2.d3]' ], 474[ "VMS->catdir('','-','','d3')", $vms_unix_rpt ? '-/d3' : '[-.d3]' ], 475[ "VMS->catdir('dir.dir','d2.dir','d3.dir')", $vms_unix_rpt ? 'dir/d2/d3' 476 : '[.dir.d2.d3]' ], 477[ "VMS->catdir('[.name]')", $vms_unix_rpt ? 'name/' : '[.name]' ], 478[ "VMS->catdir('[.name]','[.name]')", $vms_unix_rpt ? 'name/name' :'[.name.name]' ], 479[ "VMS->catdir('/a/b/c','[-]')", $vms_unix_rpt ? '/a/b/c/..' : 'a:[b]'], 480[ "VMS->catdir('a:[b.c]','..')", $vms_unix_rpt ? '/a/b/c/..' : 'a:[b]'], 481 482[ "VMS->abs2rel('node::volume:[t1.t2.t3]','node::volume:[t1.t2.t3]')", $vms_unix_rpt ? './' : '[]' ], 483[ "VMS->abs2rel('node::volume:[t1.t2.t3]','[t1.t2.t3]')", $vms_unix_rpt ? '/node//volume/t1/t2/t3/' : 'node::volume:[t1.t2.t3]' ], 484[ "VMS->abs2rel('node::volume:[t1.t2.t4]','node::volume:[t1.t2.t3]')", $vms_unix_rpt ? '../t4/' : '[-.t4]' ], 485[ "VMS->abs2rel('node::volume:[t1.t2.t4]','[t1.t2.t3]')", $vms_unix_rpt ? '/node//volume/t1/t2/t4/' : 'node::volume:[t1.t2.t4]' ], 486[ "VMS->abs2rel('[t1.t2.t3]','[t1.t2.t3]')", $vms_unix_rpt ? './' : '[]' ], 487[ "VMS->abs2rel('[t1.t2.t3]file','[t1.t2.t3]')", 'file' ], 488[ "VMS->abs2rel('[t1.t2.t3]file','[t1.t2]')", $vms_unix_rpt ? 't3/file' : '[.t3]file' ], 489[ "VMS->abs2rel('v:[t1.t2.t3]file','v:[t1.t2]')", $vms_unix_rpt ? 't3/file' : '[.t3]file' ], 490[ "VMS->abs2rel('[t1.t2.t4]','[t1.t2.t3]')", $vms_unix_rpt ? '../t4/' : '[-.t4]' ], 491[ "VMS->abs2rel('[t1.t2]file','[t1.t2.t3]')", $vms_unix_rpt ? '../file' : '[-]file' ], 492[ "VMS->abs2rel('[t1.t2.t3.t4]','[t1.t2.t3]')", $vms_unix_rpt ? 't4/' : '[.t4]' ], 493[ "VMS->abs2rel('[t4.t5.t6]','[t1.t2.t3]')", $vms_unix_rpt ? '../../../t4/t5/t6/' : '[---.t4.t5.t6]' ], 494[ "VMS->abs2rel('[000000]','[t1.t2.t3]')", $vms_unix_rpt ? '../../../' : '[---]' ], 495[ "VMS->abs2rel('a:[t1.t2.t4]','a:[t1.t2.t3]')", $vms_unix_rpt ? '../t4/' : '[-.t4]' ], 496[ "VMS->abs2rel('a:[t1.t2.t4]','[t1.t2.t3]')", $vms_unix_rpt ? '/a/t1/t2/t4/' : 'a:[t1.t2.t4]' ], 497[ "VMS->abs2rel('[a.-.b.c.-]','[t1.t2.t3]')", $vms_unix_rpt ? '../../../b/' : '[---.b]' ], 498 499[ "VMS->rel2abs('[.t4]','[t1.t2.t3]')", $vms_unix_rpt ? '/sys$disk/t1/t2/t3/t4/' : '[t1.t2.t3.t4]' ], 500[ "VMS->rel2abs('[.t4.t5]','[t1.t2.t3]')", $vms_unix_rpt ? '/sys$disk/t1/t2/t3/t4/t5/' : '[t1.t2.t3.t4.t5]' ], 501[ "VMS->rel2abs('[]','[t1.t2.t3]')", $vms_unix_rpt ? '/sys$disk/t1/t2/t3/' : '[t1.t2.t3]' ], 502[ "VMS->rel2abs('[-]','[t1.t2.t3]')", $vms_unix_rpt ? '/sys$disk/t1/t2/' : '[t1.t2]' ], 503[ "VMS->rel2abs('[-.t4]','[t1.t2.t3]')", $vms_unix_rpt ? '/sys$disk/t1/t2/t4/' : '[t1.t2.t4]' ], 504[ "VMS->rel2abs('[t1]','[t1.t2.t3]')", $vms_unix_rpt ? '/sys$disk/t1/' : '[t1]' ], 505 506[ "VMS->file_name_is_absolute('foo:')", '1' ], 507[ "VMS->file_name_is_absolute('foo:bar.dat')", '1' ], 508[ "VMS->file_name_is_absolute('foo:[000000]bar.dat')", '1' ], 509 510[ "OS2->case_tolerant()", '1' ], 511 512[ "OS2->catdir('A:/d1','B:/d2','d3','')", 'A:/d1/B:/d2/d3' ], 513 514[ "OS2->catfile('a','b','c')", 'a/b/c' ], 515[ "OS2->catfile('a','b','./c')", 'a/b/c' ], 516[ "OS2->catfile('./a','b','c')", 'a/b/c' ], 517[ "OS2->catfile('c')", 'c' ], 518[ "OS2->catfile('./c')", 'c' ], 519 520[ "OS2->catdir('/', '../')", '/' ], 521[ "OS2->catdir('/', '..\\')", '/' ], 522[ "OS2->catdir('\\', '../')", '/' ], 523[ "OS2->catdir('\\', '..\\')", '/' ], 524 525[ "Mac->case_tolerant()", '1' ], 526 527[ "Mac->catpath('','','')", '' ], 528[ "Mac->catpath('',':','')", ':' ], 529[ "Mac->catpath('','::','')", '::' ], 530 531[ "Mac->catpath('hd','','')", 'hd:' ], 532[ "Mac->catpath('hd:','','')", 'hd:' ], 533[ "Mac->catpath('hd:',':','')", 'hd:' ], 534[ "Mac->catpath('hd:','::','')", 'hd::' ], 535 536[ "Mac->catpath('hd','','file')", 'hd:file' ], 537[ "Mac->catpath('hd',':','file')", 'hd:file' ], 538[ "Mac->catpath('hd','::','file')", 'hd::file' ], 539[ "Mac->catpath('hd',':::','file')", 'hd:::file' ], 540 541[ "Mac->catpath('hd:','',':file')", 'hd:file' ], 542[ "Mac->catpath('hd:',':',':file')", 'hd:file' ], 543[ "Mac->catpath('hd:','::',':file')", 'hd::file' ], 544[ "Mac->catpath('hd:',':::',':file')", 'hd:::file' ], 545 546[ "Mac->catpath('hd:','d1','file')", 'hd:d1:file' ], 547[ "Mac->catpath('hd:',':d1:',':file')", 'hd:d1:file' ], 548[ "Mac->catpath('hd:','hd:d1','')", 'hd:d1:' ], 549 550[ "Mac->catpath('','d1','')", ':d1:' ], 551[ "Mac->catpath('',':d1','')", ':d1:' ], 552[ "Mac->catpath('',':d1:','')", ':d1:' ], 553 554[ "Mac->catpath('','d1','file')", ':d1:file' ], 555[ "Mac->catpath('',':d1:',':file')", ':d1:file' ], 556 557[ "Mac->catpath('','','file')", 'file' ], 558[ "Mac->catpath('','',':file')", 'file' ], # ! 559[ "Mac->catpath('',':',':file')", ':file' ], # ! 560 561 562[ "Mac->splitpath(':')", ',:,' ], 563[ "Mac->splitpath('::')", ',::,' ], 564[ "Mac->splitpath(':::')", ',:::,' ], 565 566[ "Mac->splitpath('file')", ',,file' ], 567[ "Mac->splitpath(':file')", ',:,file' ], 568 569[ "Mac->splitpath('d1',1)", ',:d1:,' ], # dir, not volume 570[ "Mac->splitpath(':d1',1)", ',:d1:,' ], 571[ "Mac->splitpath(':d1:',1)", ',:d1:,' ], 572[ "Mac->splitpath(':d1:')", ',:d1:,' ], 573[ "Mac->splitpath(':d1:d2:d3:')", ',:d1:d2:d3:,' ], 574[ "Mac->splitpath(':d1:d2:d3:',1)", ',:d1:d2:d3:,' ], 575[ "Mac->splitpath(':d1:file')", ',:d1:,file' ], 576[ "Mac->splitpath('::d1:file')", ',::d1:,file' ], 577 578[ "Mac->splitpath('hd:', 1)", 'hd:,,' ], 579[ "Mac->splitpath('hd:')", 'hd:,,' ], 580[ "Mac->splitpath('hd:d1:d2:')", 'hd:,:d1:d2:,' ], 581[ "Mac->splitpath('hd:d1:d2',1)", 'hd:,:d1:d2:,' ], 582[ "Mac->splitpath('hd:d1:d2:file')", 'hd:,:d1:d2:,file' ], 583[ "Mac->splitpath('hd:d1:d2::file')", 'hd:,:d1:d2::,file' ], 584[ "Mac->splitpath('hd::d1:d2:file')", 'hd:,::d1:d2:,file' ], # invalid path 585[ "Mac->splitpath('hd:file')", 'hd:,,file' ], 586 587[ "Mac->splitdir()", '' ], 588[ "Mac->splitdir('')", '' ], 589[ "Mac->splitdir(':')", ':' ], 590[ "Mac->splitdir('::')", '::' ], 591[ "Mac->splitdir(':::')", '::,::' ], 592[ "Mac->splitdir(':::d1:d2')", '::,::,d1,d2' ], 593 594[ "Mac->splitdir(':d1:d2:d3::')", 'd1,d2,d3,::'], 595[ "Mac->splitdir(':d1:d2:d3:')", 'd1,d2,d3' ], 596[ "Mac->splitdir(':d1:d2:d3')", 'd1,d2,d3' ], 597 598# absolute paths in splitdir() work, but you'd better use splitpath() 599[ "Mac->splitdir('hd:')", 'hd:' ], 600[ "Mac->splitdir('hd::')", 'hd:,::' ], # invalid path, but it works 601[ "Mac->splitdir('hd::d1:')", 'hd:,::,d1' ], # invalid path, but it works 602[ "Mac->splitdir('hd:d1:d2:::')", 'hd:,d1,d2,::,::' ], 603[ "Mac->splitdir('hd:d1:d2::')", 'hd:,d1,d2,::' ], 604[ "Mac->splitdir('hd:d1:d2:')", 'hd:,d1,d2' ], 605[ "Mac->splitdir('hd:d1:d2')", 'hd:,d1,d2' ], 606[ "Mac->splitdir('hd:d1::d2::')", 'hd:,d1,::,d2,::' ], 607 608[ "Mac->catdir()", '' ], 609[ "Mac->catdir(':')", ':' ], 610 611[ "Mac->catdir(':', ':')", ':' ], 612[ "Mac->catdir(':', '')", ':' ], 613 614[ "Mac->catdir(':', '::')", '::' ], 615 616[ "Mac->catdir('::', '')", '::' ], 617[ "Mac->catdir('::', ':')", '::' ], 618 619[ "Mac->catdir('::', '::')", ':::' ], 620 621[ "Mac->catdir(':d1')", ':d1:' ], 622[ "Mac->catdir(':d1:')", ':d1:' ], 623[ "Mac->catdir(':d1','d2')", ':d1:d2:' ], 624[ "Mac->catdir(':d1',':d2')", ':d1:d2:' ], 625[ "Mac->catdir(':d1',':d2:')", ':d1:d2:' ], 626[ "Mac->catdir(':d1',':d2::')", ':d1:d2::' ], 627[ "Mac->catdir(':',':d1',':d2')", ':d1:d2:' ], 628[ "Mac->catdir('::',':d1',':d2')", '::d1:d2:' ], 629[ "Mac->catdir('::','::',':d1',':d2')", ':::d1:d2:' ], 630[ "Mac->catdir(':',':',':d1',':d2')", ':d1:d2:' ], 631[ "Mac->catdir('::',':',':d1',':d2')", '::d1:d2:' ], 632 633[ "Mac->catdir('d1')", ':d1:' ], 634[ "Mac->catdir('d1','d2','d3')", ':d1:d2:d3:' ], 635[ "Mac->catdir('d1','d2/','d3')", ':d1:d2/:d3:' ], 636[ "Mac->catdir('d1','',':d2')", ':d1:d2:' ], 637[ "Mac->catdir('d1',':',':d2')", ':d1:d2:' ], 638[ "Mac->catdir('d1','::',':d2')", ':d1::d2:' ], 639[ "Mac->catdir('d1',':::',':d2')", ':d1:::d2:' ], 640[ "Mac->catdir('d1','::','::',':d2')", ':d1:::d2:' ], 641[ "Mac->catdir('d1','d2')", ':d1:d2:' ], 642[ "Mac->catdir('d1','d2', '')", ':d1:d2:' ], 643[ "Mac->catdir('d1','d2', ':')", ':d1:d2:' ], 644[ "Mac->catdir('d1','d2', '::')", ':d1:d2::' ], 645[ "Mac->catdir('d1','d2','','')", ':d1:d2:' ], 646[ "Mac->catdir('d1','d2',':','::')", ':d1:d2::' ], 647[ "Mac->catdir('d1','d2','::','::')", ':d1:d2:::' ], 648[ "Mac->catdir('d1',':d2')", ':d1:d2:' ], 649[ "Mac->catdir('d1',':d2:')", ':d1:d2:' ], 650 651[ "Mac->catdir('hd:',':d1')", 'hd:d1:' ], 652[ "Mac->catdir('hd:d1:',':d2')", 'hd:d1:d2:' ], 653[ "Mac->catdir('hd:','d1')", 'hd:d1:' ], 654[ "Mac->catdir('hd:d1:',':d2')", 'hd:d1:d2:' ], 655[ "Mac->catdir('hd:d1:',':d2:')", 'hd:d1:d2:' ], 656 657[ "Mac->catfile()", '' ], 658[ "Mac->catfile('')", '' ], 659[ "Mac->catfile(':')", ':' ], 660[ "Mac->catfile(':', '')", ':' ], 661 662[ "Mac->catfile('d1','d2','file')", ':d1:d2:file' ], 663[ "Mac->catfile('d1','d2',':file')", ':d1:d2:file' ], 664[ "Mac->catfile('file')", 'file' ], 665[ "Mac->catfile(':', 'file')", ':file' ], 666 667[ "Mac->canonpath('')", '' ], 668[ "Mac->canonpath(':')", ':' ], 669[ "Mac->canonpath('::')", '::' ], 670[ "Mac->canonpath('a::')", 'a::' ], 671[ "Mac->canonpath(':a::')", ':a::' ], 672 673[ "Mac->abs2rel('hd:d1:d2:','hd:d1:d2:')", ':' ], 674[ "Mac->abs2rel('hd:d1:d2:','hd:d1:d2:file')", ':' ], # ignore base's file portion 675[ "Mac->abs2rel('hd:d1:d2:file','hd:d1:d2:')", ':file' ], 676[ "Mac->abs2rel('hd:d1:','hd:d1:d2:')", '::' ], 677[ "Mac->abs2rel('hd:d3:','hd:d1:d2:')", ':::d3:' ], 678[ "Mac->abs2rel('hd:d3:','hd:d1:d2::')", '::d3:' ], 679[ "Mac->abs2rel('hd:d1:d4:d5:','hd:d1::d2:d3::')", '::d1:d4:d5:' ], 680[ "Mac->abs2rel('hd:d1:d4:d5:','hd:d1::d2:d3:')", ':::d1:d4:d5:' ], # first, resolve updirs in base 681[ "Mac->abs2rel('hd:d1:d3:','hd:d1:d2:')", '::d3:' ], 682[ "Mac->abs2rel('hd:d1::d3:','hd:d1:d2:')", ':::d3:' ], 683[ "Mac->abs2rel('hd:d3:','hd:d1:d2:')", ':::d3:' ], # same as above 684[ "Mac->abs2rel('hd:d1:d2:d3:','hd:d1:d2:')", ':d3:' ], 685[ "Mac->abs2rel('hd:d1:d2:d3::','hd:d1:d2:')", ':d3::' ], 686[ "Mac->abs2rel('hd1:d3:d4:d5:','hd2:d1:d2:')", 'hd1:d3:d4:d5:'], # volume mismatch 687[ "Mac->abs2rel('hd:','hd:d1:d2:')", ':::' ], 688 689[ "Mac->rel2abs(':d3:','hd:d1:d2:')", 'hd:d1:d2:d3:' ], 690[ "Mac->rel2abs(':d3:d4:','hd:d1:d2:')", 'hd:d1:d2:d3:d4:' ], 691[ "Mac->rel2abs('','hd:d1:d2:')", '' ], 692[ "Mac->rel2abs('::','hd:d1:d2:')", 'hd:d1:d2::' ], 693[ "Mac->rel2abs('::','hd:d1:d2:file')", 'hd:d1:d2::' ],# ignore base's file portion 694[ "Mac->rel2abs(':file','hd:d1:d2:')", 'hd:d1:d2:file' ], 695[ "Mac->rel2abs('::file','hd:d1:d2:')", 'hd:d1:d2::file' ], 696[ "Mac->rel2abs('::d3:','hd:d1:d2:')", 'hd:d1:d2::d3:' ], 697[ "Mac->rel2abs('hd:','hd:d1:d2:')", 'hd:' ], # path already absolute 698[ "Mac->rel2abs('hd:d3:file','hd:d1:d2:')", 'hd:d3:file' ], 699[ "Mac->rel2abs('hd:d3:','hd:d1:file')", 'hd:d3:' ], 700 701[ "Epoc->case_tolerant()", '1' ], 702 703[ "Epoc->canonpath('')", '' ], 704[ "Epoc->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ], 705[ "Epoc->canonpath('/./')", '/' ], 706[ "Epoc->canonpath('/a/./')", '/a' ], 707 708# XXX Todo, copied from Unix, but fail. Should they? 2003-07-07 Tels 709#[ "Epoc->canonpath('/a/.')", '/a' ], 710#[ "Epoc->canonpath('/.')", '/' ], 711 712[ "Cygwin->case_tolerant()", '1' ], 713[ "Cygwin->catfile('a','b','c')", 'a/b/c' ], 714[ "Cygwin->catfile('a','b','./c')", 'a/b/c' ], 715[ "Cygwin->catfile('./a','b','c')", 'a/b/c' ], 716[ "Cygwin->catfile('c')", 'c' ], 717[ "Cygwin->catfile('./c')", 'c' ], 718 719[ "Cygwin->splitpath('file')", ',,file' ], 720[ "Cygwin->splitpath('/d1/d2/d3/')", ',/d1/d2/d3/,' ], 721[ "Cygwin->splitpath('d1/d2/d3/')", ',d1/d2/d3/,' ], 722[ "Cygwin->splitpath('/d1/d2/d3/.')", ',/d1/d2/d3/.,' ], 723[ "Cygwin->splitpath('/d1/d2/d3/..')", ',/d1/d2/d3/..,' ], 724[ "Cygwin->splitpath('/d1/d2/d3/.file')", ',/d1/d2/d3/,.file' ], 725[ "Cygwin->splitpath('d1/d2/d3/file')", ',d1/d2/d3/,file' ], 726[ "Cygwin->splitpath('/../../d1/')", ',/../../d1/,' ], 727[ "Cygwin->splitpath('/././d1/')", ',/././d1/,' ], 728 729[ "Cygwin->catpath('','','file')", 'file' ], 730[ "Cygwin->catpath('','/d1/d2/d3/','')", '/d1/d2/d3/' ], 731[ "Cygwin->catpath('','d1/d2/d3/','')", 'd1/d2/d3/' ], 732[ "Cygwin->catpath('','/d1/d2/d3/.','')", '/d1/d2/d3/.' ], 733[ "Cygwin->catpath('','/d1/d2/d3/..','')", '/d1/d2/d3/..' ], 734[ "Cygwin->catpath('','/d1/d2/d3/','.file')", '/d1/d2/d3/.file' ], 735[ "Cygwin->catpath('','d1/d2/d3/','file')", 'd1/d2/d3/file' ], 736[ "Cygwin->catpath('','/../../d1/','')", '/../../d1/' ], 737[ "Cygwin->catpath('','/././d1/','')", '/././d1/' ], 738[ "Cygwin->catpath('d1','d2/d3/','')", 'd2/d3/' ], 739[ "Cygwin->catpath('d1','d2','d3/')", 'd2/d3/' ], 740 741[ "Cygwin->splitdir('')", '' ], 742[ "Cygwin->splitdir('/d1/d2/d3/')", ',d1,d2,d3,' ], 743[ "Cygwin->splitdir('d1/d2/d3/')", 'd1,d2,d3,' ], 744[ "Cygwin->splitdir('/d1/d2/d3')", ',d1,d2,d3' ], 745[ "Cygwin->splitdir('d1/d2/d3')", 'd1,d2,d3' ], 746 747[ "Cygwin->catdir()", '' ], 748[ "Cygwin->catdir('/')", '/' ], 749[ "Cygwin->catdir('','d1','d2','d3','')", '/d1/d2/d3' ], 750[ "Cygwin->catdir('d1','d2','d3','')", 'd1/d2/d3' ], 751[ "Cygwin->catdir('','d1','d2','d3')", '/d1/d2/d3' ], 752[ "Cygwin->catdir('d1','d2','d3')", 'd1/d2/d3' ], 753[ "Cygwin->catdir('/','d2/d3')", '/d2/d3' ], 754 755[ "Cygwin->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ], 756[ "Cygwin->canonpath('')", '' ], 757[ "Cygwin->canonpath('a/../../b/c')", 'a/../../b/c' ], 758[ "Cygwin->canonpath('/.')", '/' ], 759[ "Cygwin->canonpath('/./')", '/' ], 760[ "Cygwin->canonpath('/a/./')", '/a' ], 761[ "Cygwin->canonpath('/a/.')", '/a' ], 762[ "Cygwin->canonpath('/../../')", '/' ], 763[ "Cygwin->canonpath('/../..')", '/' ], 764 765[ "Cygwin->abs2rel('/t1/t2/t3','/t1/t2/t3')", '.' ], 766[ "Cygwin->abs2rel('/t1/t2/t4','/t1/t2/t3')", '../t4' ], 767[ "Cygwin->abs2rel('/t1/t2','/t1/t2/t3')", '..' ], 768[ "Cygwin->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')", 't4' ], 769[ "Cygwin->abs2rel('/t4/t5/t6','/t1/t2/t3')", '../../../t4/t5/t6' ], 770#[ "Cygwin->abs2rel('../t4','/t1/t2/t3')", '../t4' ], 771[ "Cygwin->abs2rel('/','/t1/t2/t3')", '../../..' ], 772[ "Cygwin->abs2rel('///','/t1/t2/t3')", '../../..' ], 773[ "Cygwin->abs2rel('/.','/t1/t2/t3')", '../../..' ], 774[ "Cygwin->abs2rel('/./','/t1/t2/t3')", '../../..' ], 775#[ "Cygwin->abs2rel('../t4','/t1/t2/t3')", '../t4' ], 776[ "Cygwin->abs2rel('/t1/t2/t3', '/')", 't1/t2/t3' ], 777[ "Cygwin->abs2rel('/t1/t2/t3', '/t1')", 't2/t3' ], 778[ "Cygwin->abs2rel('t1/t2/t3', 't1')", 't2/t3' ], 779[ "Cygwin->abs2rel('t1/t2/t3', 't4')", '../t1/t2/t3' ], 780 781[ "Cygwin->rel2abs('t4','/t1/t2/t3')", '/t1/t2/t3/t4' ], 782[ "Cygwin->rel2abs('t4/t5','/t1/t2/t3')", '/t1/t2/t3/t4/t5' ], 783[ "Cygwin->rel2abs('.','/t1/t2/t3')", '/t1/t2/t3' ], 784[ "Cygwin->rel2abs('..','/t1/t2/t3')", '/t1/t2/t3/..' ], 785[ "Cygwin->rel2abs('../t4','/t1/t2/t3')", '/t1/t2/t3/../t4' ], 786[ "Cygwin->rel2abs('/t1','/t1/t2/t3')", '/t1' ], 787[ "Cygwin->rel2abs('//t1/t2/t3','/foo')", '//t1/t2/t3' ], 788 789) ; 790 791can_ok('File::Spec::Win32', '_cwd'); 792 793{ 794 package File::Spec::FakeWin32; 795 use vars qw(@ISA); 796 @ISA = qw(File::Spec::Win32); 797 798 sub _cwd { 'C:\\one\\two' } 799 800 # Some funky stuff to override Cwd::getdcwd() for testing purposes, 801 # in the limited scope of the rel2abs() method. 802 if ($Cwd::VERSION && $Cwd::VERSION gt '2.17') { # Avoid a 'used only once' warning 803 local $^W; 804 *rel2abs = sub { 805 my $self = shift; 806 local $^W; 807 local *Cwd::getdcwd = sub { 808 return 'D:\alpha\beta' if $_[0] eq 'D:'; 809 return 'C:\one\two' if $_[0] eq 'C:'; 810 return; 811 }; 812 *Cwd::getdcwd = *Cwd::getdcwd; # Avoid a 'used only once' warning 813 return $self->SUPER::rel2abs(@_); 814 }; 815 *rel2abs = *rel2abs; # Avoid a 'used only once' warning 816 } 817} 818 819# Tries a named function with the given args and compares the result against 820# an expected result. Works with functions that return scalars or arrays. 821for ( @tests ) { 822 my ($function, $expected) = @$_; 823 824 $function =~ s#\\#\\\\#g ; 825 $function =~ s/^([^\$].*->)/File::Spec::$1/; 826 my $got = join ',', eval $function; 827 828 SKIP: { 829 if ($@) { 830 skip "skip $function: $skip_exception", 1 831 if $@ =~ /^\Q$skip_exception/; 832 is($@, '', $function); 833 } else { 834 is($got, $expected, $function); 835 } 836 } 837} 838 839is +File::Spec::Unix->canonpath(), undef; 840 841done_testing(); 842