📄 filespec.t
字号:
[ "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')", '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]' ],[ "VMS->catpath('node\"access_spec\"::volume:','[d1.d2.d3]','file')", 'node"access_spec"::volume:[d1.d2.d3]file' ],[ "VMS->canonpath('')", '' ],[ "VMS->canonpath('volume:[d1]file')", 'volume:[d1]file' ],[ "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('')", '' ],[ "VMS->splitdir('[]')", '' ],[ "VMS->splitdir('d1.d2.d3')", 'd1,d2,d3' ],[ "VMS->splitdir('[d1.d2.d3]')", 'd1,d2,d3' ],[ "VMS->splitdir('.d1.d2.d3')", ',d1,d2,d3' ],[ "VMS->splitdir('[.d1.d2.d3]')", ',d1,d2,d3' ],[ "VMS->splitdir('.-.d2.d3')", ',-,d2,d3' ],[ "VMS->splitdir('[.-.d2.d3]')", ',-,d2,d3' ],[ "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]' ],[ "VMS->abs2rel('[t1.t2.t3]','[t1.t2.t3]')", '' ],[ "VMS->abs2rel('[t1.t2.t3]file','[t1.t2.t3]')", 'file' ],[ "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('[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]' ],[ "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' ],[ "OS2->catfile('a','b','c')", 'a/b/c' ],[ "Mac->splitpath('file')", ',,file' ],[ "Mac->splitpath(':file')", ',:,file' ],[ "Mac->splitpath(':d1',1)", ',:d1:,' ],[ "Mac->splitpath('d1',1)", 'd1:,,' ],[ "Mac->splitpath('d1:d2:d3:')", 'd1:,d2:d3:,' ],[ "Mac->splitpath('d1:d2:d3',1)", 'd1:,d2:d3:,' ],[ "Mac->splitpath(':d1:d2:d3:')", ',:d1:d2:d3:,' ],[ "Mac->splitpath(':d1:d2:d3:',1)", ',:d1:d2:d3:,' ],[ "Mac->splitpath('d1:d2:d3:file')", 'd1:,d2:d3:,file' ],[ "Mac->splitpath('d1:d2:d3',1)", 'd1:,d2:d3:,' ],[ "Mac->catdir('')", ':' ],[ "Mac->catdir('d1','d2','d3')", 'd1:d2:d3:' ],[ "Mac->catdir('d1','d2/','d3')", 'd1:d2/:d3:' ],[ "Mac->catdir('','d1','d2','d3')", ':d1:d2:d3:' ],[ "Mac->catdir('','','d2','d3')", '::d2:d3:' ],[ "Mac->catdir('','','','d3')", ':::d3:' ],[ "Mac->catdir(':name')", ':name:' ],[ "Mac->catdir(':name',':name')", ':name:name:' ],[ "Mac->catfile('a','b','c')", 'a:b:c' ],[ "Mac->canonpath('')", '' ],[ "Mac->canonpath(':')", ':' ],[ "Mac->canonpath('::')", '::' ],[ "Mac->canonpath('a::')", 'a::' ],[ "Mac->canonpath(':a::')", ':a::' ],[ "Mac->abs2rel('t1:t2:t3','t1:t2:t3')", ':' ],[ "Mac->abs2rel('t1:t2','t1:t2:t3')", '::' ],[ "Mac->abs2rel('t1:t4','t1:t2:t3')", ':::t4' ],[ "Mac->abs2rel('t1:t2:t4','t1:t2:t3')", '::t4' ],[ "Mac->abs2rel('t1:t2:t3:t4','t1:t2:t3')", ':t4' ],[ "Mac->abs2rel('t4:t5:t6','t1:t2:t3')", '::::t4:t5:t6' ],[ "Mac->abs2rel('t1','t1:t2:t3')", ':::' ],[ "Mac->rel2abs(':t4','t1:t2:t3')", 't1:t2:t3:t4' ],[ "Mac->rel2abs(':t4:t5','t1:t2:t3')", 't1:t2:t3:t4:t5' ],[ "Mac->rel2abs('','t1:t2:t3')", '' ],[ "Mac->rel2abs('::','t1:t2:t3')", 't1:t2:t3::' ],[ "Mac->rel2abs('::t4','t1:t2:t3')", 't1:t2:t3::t4' ],[ "Mac->rel2abs('t1','t1:t2:t3')", 't1' ],) ;# Grab all of the plain routines from File::Specuse File::Spec @File::Spec::EXPORT_OK ;require File::Spec::Unix ;require File::Spec::Win32 ;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::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 ;}require File::Spec::VMS ;require File::Spec::OS2 ;require File::Spec::Mac ;print "1..", scalar( @tests ), "\n" ;my $current_test= 1 ;# Test out the class methodsfor ( @tests ) { tryfunc( @$_ ) ;}## Tries a named function with the given args and compares the result against# an expected result. Works with functions that return scalars or arrays.#sub tryfunc { my $function = shift ; my $expected = shift ; my $platform = shift ; if ($platform && $^O ne $platform) { print "ok $current_test # skipped: $function\n" ; ++$current_test ; return; } $function =~ s#\\#\\\\#g ; my $got ; if ( $function =~ /^[^\$].*->/ ) { $got = eval( "join( ',', File::Spec::$function )" ) ; } else { $got = eval( "join( ',', $function )" ) ; } if ( $@ ) { if ( substr( $@, 0, length $skip_exception ) eq $skip_exception ) { chomp $@ ; print "ok $current_test # skip $function: $@\n" ; } else { chomp $@ ; print "not ok $current_test # $function: $@\n" ; } } elsif ( !defined( $got ) || $got ne $expected ) { print "not ok $current_test # $function: got '$got', expected '$expected'\n" ; } else { print "ok $current_test # $function\n" ; } ++$current_test ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -