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