X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2Ffilespec.t;h=c6d155fac175ed07f52370cc82315ad3cde08947;hb=20822f61cc01ab34be1e17db483aceb9d5ec8fb7;hp=aba0688dadd62bfccdacf61deef395a4dcc63bb0;hpb=f6a53ef27dbc44c1f1b90bd8ebb87c79583e7021;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/lib/filespec.t b/t/lib/filespec.t index aba0688..c6d155f 100755 --- a/t/lib/filespec.t +++ b/t/lib/filespec.t @@ -3,7 +3,7 @@ BEGIN { $^O = ''; chdir 't' if -d 't'; - unshift @INC, '../lib'; + @INC = '../lib'; } # Each element in this array is a single test. Storing them this way makes @@ -181,24 +181,24 @@ BEGIN { [ "Win32->rel2abs('../','//prague_main/work')", '\\\\prague_main\\work\\..' ], [ "VMS->splitpath('file')", ',,file' ], -[ "VMS->splitpath('[d1.d2.d3]')", ',d1.d2.d3,' ], -[ "VMS->splitpath('[.d1.d2.d3]')", ',.d1.d2.d3,' ], -[ "VMS->splitpath('[d1.d2.d3]file')", ',d1.d2.d3,file' ], -[ "VMS->splitpath('d1/d2/d3/file')", ',d1/d2/d3/,file' ], -[ "VMS->splitpath('/d1/d2/d3/file')", '/d1,/d2/d3/,file' ], -[ "VMS->splitpath('[.d1.d2.d3]file')", ',.d1.d2.d3,file' ], -[ "VMS->splitpath('node::volume:[d1.d2.d3]')", 'node::volume:,d1.d2.d3,' ], -[ "VMS->splitpath('node::volume:[d1.d2.d3]file')", 'node::volume:,d1.d2.d3,file' ], -[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]')", 'node"access_spec"::volume:,d1.d2.d3,' ], -[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]file')", 'node"access_spec"::volume:,d1.d2.d3,file' ], +[ "VMS->splitpath('[d1.d2.d3]')", ',[d1.d2.d3],' ], +[ "VMS->splitpath('[.d1.d2.d3]')", ',[.d1.d2.d3],' ], +[ "VMS->splitpath('[d1.d2.d3]file')", ',[d1.d2.d3],file' ], +[ "VMS->splitpath('d1/d2/d3/file')", ',[.d1.d2.d3],file' ], +[ "VMS->splitpath('/d1/d2/d3/file')", 'd1:,[d2.d3],file' ], +[ "VMS->splitpath('[.d1.d2.d3]file')", ',[.d1.d2.d3],file' ], +[ "VMS->splitpath('node::volume:[d1.d2.d3]')", 'node::volume:,[d1.d2.d3],' ], +[ "VMS->splitpath('node::volume:[d1.d2.d3]file')", 'node::volume:,[d1.d2.d3],file' ], +[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]')", 'node"access_spec"::volume:,[d1.d2.d3],' ], +[ "VMS->splitpath('node\"access_spec\"::volume:[d1.d2.d3]file')", 'node"access_spec"::volume:,[d1.d2.d3],file' ], [ "VMS->catpath('','','file')", 'file' ], [ "VMS->catpath('','[d1.d2.d3]','')", '[d1.d2.d3]' ], [ "VMS->catpath('','[.d1.d2.d3]','')", '[.d1.d2.d3]' ], [ "VMS->catpath('','[d1.d2.d3]','file')", '[d1.d2.d3]file' ], [ "VMS->catpath('','[.d1.d2.d3]','file')", '[.d1.d2.d3]file' ], -[ "VMS->catpath('','d1/d2/d3','file')", 'd1/d2/d3/file' ], -[ "VMS->catpath('v','d1/d2/d3','file')", 'd1/d2/d3/file' ], +[ "VMS->catpath('','d1/d2/d3','file')", '[.d1.d2.d3]file' ], +[ "VMS->catpath('v','d1/d2/d3','file')", 'v:[.d1.d2.d3]file' ], [ "VMS->catpath('node::volume:','[d1.d2.d3]','')", 'node::volume:[d1.d2.d3]' ], [ "VMS->catpath('node::volume:','[d1.d2.d3]','file')", 'node::volume:[d1.d2.d3]file' ], [ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','')", 'node"access_spec"::volume:[d1.d2.d3]' ], @@ -206,8 +206,7 @@ BEGIN { [ "VMS->canonpath('')", '' ], [ "VMS->canonpath('volume:[d1]file')", 'volume:[d1]file' ], -[ "VMS->canonpath('volume:[d1.-.d2.][d3.d4.-]')", 'volume:[d1.-.d2.d3.d4.-]' ], -[ "VMS->canonpath('volume:[d1.-.d2.][d3.d4.-]',1)", 'volume:[d2.d3]' ], +[ "VMS->canonpath('volume:[d1.-.d2.][d3.d4.-]')", 'volume:[d2.d3]' ], [ "VMS->canonpath('volume:[000000.d1]d2.dir;1')", 'volume:[d1]d2.dir;1' ], [ "VMS->splitdir('')", '' ], @@ -219,20 +218,15 @@ BEGIN { [ "VMS->splitdir('.-.d2.d3')", ',-,d2,d3' ], [ "VMS->splitdir('[.-.d2.d3]')", ',-,d2,d3' ], -# these appear to need VMS::Filespec, which won't work on other platforms -[ "VMS->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c', 'VMS' ], -[ "VMS->catdir('d1','d2','d3')", '[.d1.d2.d3]', 'VMS' ], -[ "VMS->catdir('d1','d2/','d3')", '[.d1.d2.d3]', 'VMS' ], -[ "VMS->catdir('','d1','d2','d3')", '[.d1.d2.d3]', 'VMS' ], -[ "VMS->catdir('','-','d2','d3')", '[-.d2.d3]', 'VMS' ], -[ "VMS->catdir('','-','','d3')", '[-.d3]', 'VMS' ], -[ "VMS->catdir('[]','<->','[]','[d3]')", '[-.d3]', 'VMS' ], -[ "VMS->catdir('dir.dir','d2.dir','d3.dir')", '[.dir.d2.d3]','VMS' ], -[ "VMS->catdir('[.name]')", '[.name]', 'VMS' ], -[ "VMS->catdir('[.name]','[.name]')", '[.name.name]','VMS' ], - -#[ "VMS->catdir('')", '[]' ], -#[ "VMS->catdir('a:[.name]','b:[.name]')", '[.name.name]' ], +[ "VMS->catdir('')", '' ], +[ "VMS->catdir('d1','d2','d3')", '[.d1.d2.d3]' ], +[ "VMS->catdir('d1','d2/','d3')", '[.d1.d2.d3]' ], +[ "VMS->catdir('','d1','d2','d3')", '[.d1.d2.d3]' ], +[ "VMS->catdir('','-','d2','d3')", '[-.d2.d3]' ], +[ "VMS->catdir('','-','','d3')", '[-.d3]' ], +[ "VMS->catdir('dir.dir','d2.dir','d3.dir')", '[.dir.d2.d3]' ], +[ "VMS->catdir('[.name]')", '[.name]' ], +[ "VMS->catdir('[.name]','[.name]')", '[.name.name]'], [ "VMS->abs2rel('node::volume:[t1.t2.t3]','[t1.t2.t3]')", '' ], [ "VMS->abs2rel('node::volume:[t1.t2.t4]','[t1.t2.t3]')", '[-.t4]' ], @@ -241,19 +235,16 @@ BEGIN { [ "VMS->abs2rel('[t1.t2.t4]','[t1.t2.t3]')", '[-.t4]' ], [ "VMS->abs2rel('[t1.t2]file','[t1.t2.t3]')", '[-]file' ], [ "VMS->abs2rel('[t1.t2.t3.t4]','[t1.t2.t3]')", '[t4]' ], -[ "VMS->abs2rel('[t4.t5.t6]','[t1.t2.t3]')", '[-.-.-.t4.t5.t6]' ], -#[ "VMS->abs2rel('[]','[t1.t2.t3]')", '[-.-.-]' ], -#[ "VMS->abs2rel('[..]','[t1.t2.t3]')", '[-.-.-]' ], -#[ "VMS->abs2rel('[.]','[t1.t2.t3]')", '[-.-.-]' ], -#[ "VMS->abs2rel('[..]','[t1.t2.t3]')", '[-.-.-]' ], -#[ "VMS->abs2rel('a:[t1.t2.t4]','[t1.t2.t3]')", '[-.t4]' ], -#[ "VMS->abs2rel('[a.-.b.c.-]','[t1.t2.t3]')", '[-.-.-.b]' ], +[ "VMS->abs2rel('[t4.t5.t6]','[t1.t2.t3]')", '[---.t4.t5.t6]' ], +[ "VMS->abs2rel('[000000]','[t1.t2.t3]')", '[---.000000]' ], +[ "VMS->abs2rel('a:[t1.t2.t4]','[t1.t2.t3]')", '[-.t4]' ], +[ "VMS->abs2rel('[a.-.b.c.-]','[t1.t2.t3]')", '[---.b]' ], [ "VMS->rel2abs('[.t4]','[t1.t2.t3]')", '[t1.t2.t3.t4]' ], [ "VMS->rel2abs('[.t4.t5]','[t1.t2.t3]')", '[t1.t2.t3.t4.t5]' ], [ "VMS->rel2abs('[]','[t1.t2.t3]')", '[t1.t2.t3]' ], -[ "VMS->rel2abs('[-]','[t1.t2.t3]')", '[t1.t2.t3.-]' ], -[ "VMS->rel2abs('[-.t4]','[t1.t2.t3]')", '[t1.t2.t3.-.t4]' ], +[ "VMS->rel2abs('[-]','[t1.t2.t3]')", '[t1.t2]' ], +[ "VMS->rel2abs('[-.t4]','[t1.t2.t3]')", '[t1.t2.t4]' ], [ "VMS->rel2abs('[t1]','[t1.t2.t3]')", '[t1]' ], [ "OS2->catdir('A:/d1','B:/d2','d3','')", 'A:/d1/B:/d2/d3' ], @@ -313,14 +304,17 @@ eval { require VMS::Filespec ; } ; +my $skip_exception = "Install VMS::Filespec (from vms/ext)" ; + if ( $@ ) { # Not pretty, but it allows testing of things not implemented soley # on VMS. It might be better to change File::Spec::VMS to do this, # making it more usable when running on (say) Unix but working with # VMS paths. eval qq- - sub File::Spec::VMS::unixify { die "Install VMS::Filespec (from vms/ext)" } ; - sub File::Spec::VMS::vmspath { die "Install VMS::Filespec (from vms/ext)" } ; + sub File::Spec::VMS::vmsify { die "$skip_exception" } + sub File::Spec::VMS::unixify { die "$skip_exception" } + sub File::Spec::VMS::vmspath { die "$skip_exception" } - ; $INC{"VMS/Filespec.pm"} = 1 ; } @@ -366,8 +360,9 @@ sub tryfunc { } if ( $@ ) { - if ( $@ =~ /only provided on VMS/ ) { - print "ok $current_test # skip $function \n" ; + if ( substr( $@, 0, length $skip_exception ) eq $skip_exception ) { + chomp $@ ; + print "ok $current_test # skip $function: $@\n" ; } else { chomp $@ ;