diff options
author | Reini Urban <rurban@x-ray.at> | 2007-06-20 23:10:05 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-06-21 08:34:35 +0000 |
commit | e4f3fca48b547d000a2f9fa8f3ca08566d87f410 (patch) | |
tree | 4f11c60eb97f493db86c07edf64adf4522c63afe /lib/File | |
parent | 90e2bcf97e19d6356cf8a2cdb3e71af9f3694aa0 (diff) | |
download | perl-e4f3fca48b547d000a2f9fa8f3ca08566d87f410.tar.gz |
File::Spec::Cygwin more tests and silence warning
Message-ID: <46797B8D.8040002@x-ray.at>
p4raw-id: //depot/perl@31440
Diffstat (limited to 'lib/File')
-rw-r--r-- | lib/File/Spec/Cygwin.pm | 2 | ||||
-rw-r--r-- | lib/File/Spec/t/Spec.t | 73 |
2 files changed, 74 insertions, 1 deletions
diff --git a/lib/File/Spec/Cygwin.pm b/lib/File/Spec/Cygwin.pm index 9423eeca4d..e2744f00cf 100644 --- a/lib/File/Spec/Cygwin.pm +++ b/lib/File/Spec/Cygwin.pm @@ -53,7 +53,7 @@ sub catdir { my $self = shift; # Don't create something that looks like a //network/path - if ($_[0] eq '/' or $_[0] eq '\\') { + if ($_[0] and ($_[0] eq '/' or $_[0] eq '\\')) { shift; return $self->SUPER::catdir('', @_); } diff --git a/lib/File/Spec/t/Spec.t b/lib/File/Spec/t/Spec.t index 5ca4caf7e1..a39779f767 100644 --- a/lib/File/Spec/t/Spec.t +++ b/lib/File/Spec/t/Spec.t @@ -620,8 +620,81 @@ if ($^O eq 'MacOS') { #[ "Epoc->canonpath('/.')", '/' ], [ "Cygwin->case_tolerant()", '1' ], +[ "Cygwin->catfile('a','b','c')", 'a/b/c' ], +[ "Cygwin->catfile('a','b','./c')", 'a/b/c' ], +[ "Cygwin->catfile('./a','b','c')", 'a/b/c' ], +[ "Cygwin->catfile('c')", 'c' ], +[ "Cygwin->catfile('./c')", 'c' ], + +[ "Cygwin->splitpath('file')", ',,file' ], +[ "Cygwin->splitpath('/d1/d2/d3/')", ',/d1/d2/d3/,' ], +[ "Cygwin->splitpath('d1/d2/d3/')", ',d1/d2/d3/,' ], +[ "Cygwin->splitpath('/d1/d2/d3/.')", ',/d1/d2/d3/.,' ], +[ "Cygwin->splitpath('/d1/d2/d3/..')", ',/d1/d2/d3/..,' ], +[ "Cygwin->splitpath('/d1/d2/d3/.file')", ',/d1/d2/d3/,.file' ], +[ "Cygwin->splitpath('d1/d2/d3/file')", ',d1/d2/d3/,file' ], +[ "Cygwin->splitpath('/../../d1/')", ',/../../d1/,' ], +[ "Cygwin->splitpath('/././d1/')", ',/././d1/,' ], + +[ "Cygwin->catpath('','','file')", 'file' ], +[ "Cygwin->catpath('','/d1/d2/d3/','')", '/d1/d2/d3/' ], +[ "Cygwin->catpath('','d1/d2/d3/','')", 'd1/d2/d3/' ], +[ "Cygwin->catpath('','/d1/d2/d3/.','')", '/d1/d2/d3/.' ], +[ "Cygwin->catpath('','/d1/d2/d3/..','')", '/d1/d2/d3/..' ], +[ "Cygwin->catpath('','/d1/d2/d3/','.file')", '/d1/d2/d3/.file' ], +[ "Cygwin->catpath('','d1/d2/d3/','file')", 'd1/d2/d3/file' ], +[ "Cygwin->catpath('','/../../d1/','')", '/../../d1/' ], +[ "Cygwin->catpath('','/././d1/','')", '/././d1/' ], +[ "Cygwin->catpath('d1','d2/d3/','')", 'd2/d3/' ], +[ "Cygwin->catpath('d1','d2','d3/')", 'd2/d3/' ], + +[ "Cygwin->splitdir('')", '' ], +[ "Cygwin->splitdir('/d1/d2/d3/')", ',d1,d2,d3,' ], +[ "Cygwin->splitdir('d1/d2/d3/')", 'd1,d2,d3,' ], +[ "Cygwin->splitdir('/d1/d2/d3')", ',d1,d2,d3' ], +[ "Cygwin->splitdir('d1/d2/d3')", 'd1,d2,d3' ], + +[ "Cygwin->catdir()", '' ], +[ "Cygwin->catdir('/')", '/' ], +[ "Cygwin->catdir('','d1','d2','d3','')", '/d1/d2/d3' ], +[ "Cygwin->catdir('d1','d2','d3','')", 'd1/d2/d3' ], +[ "Cygwin->catdir('','d1','d2','d3')", '/d1/d2/d3' ], +[ "Cygwin->catdir('d1','d2','d3')", 'd1/d2/d3' ], [ "Cygwin->catdir('/','d2/d3')", '/d2/d3' ], +[ "Cygwin->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c' ], +[ "Cygwin->canonpath('')", '' ], +[ "Cygwin->canonpath('a/../../b/c')", 'a/../../b/c' ], +[ "Cygwin->canonpath('/.')", '/' ], +[ "Cygwin->canonpath('/./')", '/' ], +[ "Cygwin->canonpath('/a/./')", '/a' ], +[ "Cygwin->canonpath('/a/.')", '/a' ], +[ "Cygwin->canonpath('/../../')", '/' ], +[ "Cygwin->canonpath('/../..')", '/' ], + +[ "Cygwin->abs2rel('/t1/t2/t3','/t1/t2/t3')", '.' ], +[ "Cygwin->abs2rel('/t1/t2/t4','/t1/t2/t3')", '../t4' ], +[ "Cygwin->abs2rel('/t1/t2','/t1/t2/t3')", '..' ], +[ "Cygwin->abs2rel('/t1/t2/t3/t4','/t1/t2/t3')", 't4' ], +[ "Cygwin->abs2rel('/t4/t5/t6','/t1/t2/t3')", '../../../t4/t5/t6' ], +#[ "Cygwin->abs2rel('../t4','/t1/t2/t3')", '../t4' ], +[ "Cygwin->abs2rel('/','/t1/t2/t3')", '../../..' ], +[ "Cygwin->abs2rel('///','/t1/t2/t3')", '../../..' ], +[ "Cygwin->abs2rel('/.','/t1/t2/t3')", '../../..' ], +[ "Cygwin->abs2rel('/./','/t1/t2/t3')", '../../..' ], +#[ "Cygwin->abs2rel('../t4','/t1/t2/t3')", '../t4' ], +[ "Cygwin->abs2rel('/t1/t2/t3', '/')", 't1/t2/t3' ], +[ "Cygwin->abs2rel('/t1/t2/t3', '/t1')", 't2/t3' ], +[ "Cygwin->abs2rel('t1/t2/t3', 't1')", 't2/t3' ], +[ "Cygwin->abs2rel('t1/t2/t3', 't4')", '../t1/t2/t3' ], + +[ "Cygwin->rel2abs('t4','/t1/t2/t3')", '/t1/t2/t3/t4' ], +[ "Cygwin->rel2abs('t4/t5','/t1/t2/t3')", '/t1/t2/t3/t4/t5' ], +[ "Cygwin->rel2abs('.','/t1/t2/t3')", '/t1/t2/t3' ], +[ "Cygwin->rel2abs('..','/t1/t2/t3')", '/t1/t2/t3/..' ], +[ "Cygwin->rel2abs('../t4','/t1/t2/t3')", '/t1/t2/t3/../t4' ], +[ "Cygwin->rel2abs('/t1','/t1/t2/t3')", '/t1' ], + ) ; |