📄 filename.test
字号:
} {0 .}test filename-12.1.4 {simple globbing} {pcOnly} { list [catch {glob -types hidden {}} msg] $msg} {1 {no files matched glob pattern ""}}test filename-12.1.5 {simple globbing} {pcOnly} { list [catch {glob -types hidden c:/} msg] $msg} {1 {no files matched glob pattern "c:/"}}test filename-12.1.6 {simple globbing} {pcOnly} { list [catch {glob c:/} msg] $msg} {0 c:/}test filename-12.2 {simple globbing} {macOnly} { list [catch {glob {}} msg] $msg} {0 :}test filename-12.2.1 {simple globbing} {macOnly} { list [catch {glob -types f {}} msg] $msg} {1 {no files matched glob pattern ""}}test filename-12.2.2 {simple globbing} {macOnly} { list [catch {glob -types d {}} msg] $msg} {0 :}test filename-12.2.3 {simple globbing} {macOnly} { list [catch {glob -types hidden {}} msg] $msg} {1 {no files matched glob pattern ""}}test filename-12.3 {simple globbing} { list [catch {glob -nocomplain \{a1,a2\}} msg] $msg} {0 {}}if {$tcl_platform(platform) == "macintosh"} { set globPreResult :globTest:} else { set globPreResult globTest/}set x1 x1.cset y1 y1.ctest filename-12.4 {simple globbing} {unixOrPc} { lsort [glob globTest/x1.c globTest/y1.c globTest/foo]} "$globPreResult$x1 $globPreResult$y1"test filename-12.5 {simple globbing} { list [catch {glob globTest\\/x1.c} msg] $msg} "0 $globPreResult$x1"test filename-12.6 {simple globbing} { list [catch {glob globTest\\/\\x1.c} msg] $msg} "0 $globPreResult$x1"test filename-13.1 {globbing with brace substitution} { list [catch {glob globTest/\{\}} msg] $msg} "0 $globPreResult"test filename-13.2 {globbing with brace substitution} { list [catch {glob globTest/\{} msg] $msg} {1 {unmatched open-brace in file name}}test filename-13.3 {globbing with brace substitution} { list [catch {glob globTest/\{\\\}} msg] $msg} {1 {unmatched open-brace in file name}}test filename-13.4 {globbing with brace substitution} { list [catch {glob globTest/\{\\} msg] $msg} {1 {unmatched open-brace in file name}}test filename-13.5 {globbing with brace substitution} { list [catch {glob globTest/\}} msg] $msg} {1 {unmatched close-brace in file name}}test filename-13.6 {globbing with brace substitution} { list [catch {glob globTest/\{\}x1.c} msg] $msg} "0 $globPreResult$x1"test filename-13.7 {globbing with brace substitution} { list [catch {glob globTest/\{x\}1.c} msg] $msg} "0 $globPreResult$x1"test filename-13.8 {globbing with brace substitution} { list [catch {glob globTest/\{x\{\}\}1.c} msg] $msg} "0 $globPreResult$x1"test filename-13.9 {globbing with brace substitution} { list [lsort [catch {glob globTest/\{x,y\}1.c} msg]] $msg} [list 0 [list $globPreResult$x1 $globPreResult$y1]]test filename-13.10 {globbing with brace substitution} { list [lsort [catch {glob globTest/\{x,,y\}1.c} msg]] $msg} [list 0 [list $globPreResult$x1 $globPreResult$y1]]test filename-13.11 {globbing with brace substitution} {unixOrPc} { list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg} {0 {globTest/x1.c globTest/x,z1.c globTest/z1.c}}test filename-13.12 {globbing with brace substitution} {macOnly} { list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg} {0 {:globTest:x1.c :globTest:x,z1.c :globTest:z1.c}}test filename-13.13 {globbing with brace substitution} { lsort [glob globTest/{a,b,x,y}1.c]} [list $globPreResult$x1 $globPreResult$y1]test filename-13.14 {globbing with brace substitution} {unixOrPc} { lsort [glob {globTest/{x1,y2,weird name}.c}]} {{globTest/weird name.c} globTest/x1.c}test filename-13.15 {globbing with brace substitution} {macOnly} { lsort [glob {globTest/{x1,y2,weird name}.c}]} {{:globTest:weird name.c} :globTest:x1.c}test filename-13.16 {globbing with brace substitution} {unixOrPc} { lsort [glob globTest/{x1.c,a1/*}]} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}test filename-13.17 {globbing with brace substitution} {macOnly} { lsort [glob globTest/{x1.c,a1/*}]} {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}test filename-13.18 {globbing with brace substitution} {unixOrPc} { lsort [glob globTest/{x1.c,{a},a1/*}]} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}test filename-13.19 {globbing with brace substitution} {macOnly} { lsort [glob globTest/{x1.c,{a},a1/*}]} {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}test filename-13.20 {globbing with brace substitution} {unixOrPc} { lsort [glob globTest/{a,x}1/*/{x,y}*]} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}test filename-13.21 {globbing with brace substitution} {macOnly} { lsort [glob globTest/{a,x}1/*/{x,y}*]} {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}test filename-13.22 {globbing with brace substitution} { list [catch {glob globTest/\{a,x\}1/*/\{} msg] $msg} {1 {unmatched open-brace in file name}}test filename-14.1 {asterisks, question marks, and brackets} {unixOrPc} { lsort [glob glo*/*.c]} {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}test filename-14.2 {asterisks, question marks, and brackets} {macOnly} { lsort [glob glo*/*.c]} {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}test filename-14.3 {asterisks, question marks, and brackets} {unixOrPc} { lsort [glob globTest/?1.c]} {globTest/x1.c globTest/y1.c globTest/z1.c}test filename-14.4 {asterisks, question marks, and brackets} {macOnly} { lsort [glob globTest/?1.c]} {:globTest:x1.c :globTest:y1.c :globTest:z1.c}# The current directory could be anywhere; do this to stop spurious matchesfile mkdir globTestContextfile rename globTest [file join globTestContext globTest]set savepwd [pwd]cd globTestContexttest filename-14.5 {asterisks, question marks, and brackets} {unixOrPc} { lsort [glob */*/*/*.c]} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}test filename-14.6 {asterisks, question marks, and brackets} {macOnly} { lsort [glob */*/*/*.c]} {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}# Reset to where we werecd $savepwdfile rename [file join globTestContext globTest] globTestfile delete globTestContexttest filename-14.7 {asterisks, question marks, and brackets} {unixOnly} { lsort [glob globTest/*]} {globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}test filename-14.7.1 {asterisks, question marks, and brackets} {pcOnly} { lsort [glob globTest/*]} {globTest/.1 globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}test filename-14.8 {asterisks, question marks, and brackets} {macOnly} { lsort [glob globTest/*]} {:globTest:.1 :globTest:a1 :globTest:a2 :globTest:a3 {:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}test filename-14.9 {asterisks, question marks, and brackets} {unixOrPc} { lsort [glob globTest/.*]} {globTest/. globTest/.. globTest/.1}test filename-14.10 {asterisks, question marks, and brackets} {macOnly} { lsort [glob globTest/.*]} {:globTest:.1}test filename-14.11 {asterisks, question marks, and brackets} {unixOrPc} { lsort [glob globTest/*/*]} {globTest/a1/b1 globTest/a1/b2 globTest/a2/b3}test filename-14.12 {asterisks, question marks, and brackets} {macOnly} { lsort [glob globTest/*/*]} {:globTest:a1:b1 :globTest:a1:b2 :globTest:a2:b3}test filename-14.13 {asterisks, question marks, and brackets} {unixOrPc} { lsort [glob {globTest/[xyab]1.*}]} {globTest/x1.c globTest/y1.c}test filename-14.14 {asterisks, question marks, and brackets} {macOnly} { lsort [glob {globTest/[xyab]1.*}]} {:globTest:x1.c :globTest:y1.c}test filename-14.15 {asterisks, question marks, and brackets} {unixOrPc} { lsort [glob globTest/*/]} {globTest/a1/ globTest/a2/ globTest/a3/}test filename-14.16 {asterisks, question marks, and brackets} {macOnly} { lsort [glob globTest/*/]} {:globTest:a1: :globTest:a2: :globTest:a3:}test filename-14.17 {asterisks, question marks, and brackets} { global env set temp $env(HOME) set env(HOME) [file join $env(HOME) globTest] set result [list [catch {glob ~/z*} msg] $msg] set env(HOME) $temp set result} [list 0 [list [file join $env(HOME) globTest z1.c]]]test filename-14.18 {asterisks, question marks, and brackets} {unixOrPc} { list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg} {0 {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}}test filename-14.19 {asterisks, question marks, and brackets} {macOnly} { list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg} {0 {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}}test filename-14.20 {asterisks, question marks, and brackets} { list [catch {glob -nocomplain goo/*} msg] $msg} {0 {}}test filename-14.21 {asterisks, question marks, and brackets} { list [catch {glob globTest/*/gorp} msg] $msg} {1 {no files matched glob pattern "globTest/*/gorp"}}test filename-14.22 {asterisks, question marks, and brackets} { list [catch {glob goo/* x*z foo?q} msg] $msg} {1 {no files matched glob patterns "goo/* x*z foo?q"}}test filename-14.23 {slash globbing} {unixOrPc} { glob /} /test filename-14.24 {slash globbing} {pcOnly} { glob {\\}} /test filename-14.25 {type specific globbing} {unixOnly} { list [catch {lsort [glob -dir globTest -types f *]} msg] $msg} [list 0 [lsort [list \ [file join $globname "weird name.c"]\ [file join $globname x,z1.c]\ [file join $globname x1.c]\ [file join $globname y1.c] [file join $globname z1.c]]]]test filename-14.25.1 {type specific globbing} {pcOnly macOnly} { list [catch {lsort [glob -dir globTest -types f *]} msg] $msg} [list 0 [lsort [list \ [file join $globname .1]\ [file join $globname "weird name.c"]\ [file join $globname x,z1.c]\ [file join $globname x1.c]\ [file join $globname y1.c] [file join $globname z1.c]]]]test filename-14.26 {type specific globbing} { list [catch {glob -nocomplain -dir globTest -types {readonly} *} msg] $msg} [list 0 {}]unset globname# The following tests are only valid for Unix systems.# On some systems, like AFS, "000" protection doesn't prevent# access by owner, so the following test is not portable.catch {file attributes globTest/a1 -permissions 0000}test filename-15.1 {unix specific globbing} {unixOnly nonPortable} { string tolower [list [catch {glob globTest/a1/*} msg] $msg $errorCode]} {1 {couldn't read directory "globtest/a1": permission denied} {posix eacces {permission denied}}}test filename-15.2 {unix specific no complain: no errors} {unixOnly nonPortable} { glob -nocomplain globTest/a1/*} {}test filename-15.3 {unix specific no complain: no errors, good result} \ {unixOnly nonPortable} { # test fails because if an error occur , the interp's result # is reset... glob -nocomplain globTest/a2 globTest/a1/* globTest/a3} {globTest/a2 globTest/a3}catch {file attributes globTest/a1 -permissions 0755}test filename-15.4 {unix specific no complain: no errors, good result} \ {unixOnly nonPortable} { # test fails because if an error occurs, the interp's result # is reset... or you don't run at scriptics where the # outser and welch users exists glob -nocomplain ~ouster ~foo ~welch} {/home/ouster /home/welch}test filename-15.4.1 {no complain: no errors, good result} { # test used to fail because if an error occurs, the interp's result # is reset... string equal [glob -nocomplain ~wontexist ~blah ~] \ [glob -nocomplain ~ ~blah ~wontexist]} {1}test filename-15.5 {unix specific globbing} {unixOnly nonPortable} { glob ~ouster/.csh*} "/home/ouster/.cshrc"catch {close [open globTest/odd\\\[\]*?\{\}name w]}test filename-15.6 {unix specific globbing} {unixOnly} { global env set temp $env(HOME) set env(HOME) $env(HOME)/globTest/odd\\\[\]*?\{\}name set result [list [catch {glob ~} msg] $msg] set env(HOME) $temp set result} [list 0 [list [lindex [glob ~] 0]/globTest/odd\\\[\]*?\{\}name]]catch {file delete -force globTest/odd\\\[\]*?\{\}name}# The following tests are only valid for Windows systems.set oldDir [pwd]if {$::tcltest::testConstraints(pcOnly)} { cd c:/ file delete -force globTest file mkdir globTest close [open globTest/x1.BAT w] close [open globTest/y1.Bat w] close [open globTest/z1.bat w]}test filename-16.1 {windows specific globbing} {pcOnly} { lsort [glob globTest/*.bat]} {globTest/x1.BAT globTest/y1.Bat globTest/z1.bat}test filename-16.2 {windows specific globbing} {pcOnly} { glob c:} c:test filename-16.3 {windows specific globbing} {pcOnly} { glob c:\\\\} c:/test filename-16.4 {windows specific globbing} {pcOnly} { glob c:/} c:/test filename-16.5 {windows specific globbing} {pcOnly} { glob c:*bTest} c:globTesttest filename-16.6 {windows specific globbing} {pcOnly} { glob c:\\\\*bTest} c:/globTesttest filename-16.7 {windows specific globbing} {pcOnly} { glob c:/*bTest} c:/globTesttest filename-16.8 {windows specific globbing} {pcOnly} { lsort [glob c:globTest/*.bat]} {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}test filename-16.9 {windows specific globbing} {pcOnly} { lsort [glob c:/globTest/*.bat]} {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}test filename-16.10 {windows specific globbing} {pcOnly} { lsort [glob c:globTest\\\\*.bat]} {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}test filename-16.11 {windows specific globbing} {pcOnly} { lsort [glob c:\\\\globTest\\\\*.bat]} {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}# some tests require a shared C driveif {[catch {cd //[info hostname]/c}]} { set ::tcltest::testConstraints(sharedCdrive) 0} else { set ::tcltest::testConstraints(sharedCdrive) 1}test filename-16.12 {windows specific globbing} {pcOnly sharedCdrive} { cd //[info hostname]/c glob //[info hostname]/c/*Test} //[info hostname]/c/globTesttest filename-16.13 {windows specific globbing} {pcOnly sharedCdrive} { cd //[info hostname]/c glob "\\\\\\\\[info hostname]\\\\c\\\\*Test"} //[info hostname]/c/globTesttest filename-16.14 {windows specific globbing} {pcOnly} { cd [lindex [glob -types d -dir C:/ *] 0] expr {[lsearch -exact [glob {{.,*}*}] ".."] != -1}} {1}test filename-16.15 {windows specific globbing} {pcOnly} { cd [lindex [glob -types d -dir C:/ *] 0] glob ..} {..}test filename-16.16 {windows specific globbing} {pcOnly} { file tail [lindex [glob "[lindex [glob -types d -dir C:/ *] 0]/.."] 0]} {..}test filename-17.1 {windows specific special files} {testsetplatform} { testsetplatform win list [file pathtype com1] [file pathtype con] [file pathtype lpt3] \ [file pathtype prn] [file pathtype nul] [file pathtype aux] \ [file pathtype foo]} {absolute absolute absolute absolute absolute absolute relative}test filename-17.2 {windows specific glob with executable} {winOnly} { makeDirectory execglob makeFile contents execglob/abc.exe makeFile contents execglob/abc.notexecutable set res [glob -nocomplain -dir [temporaryDirectory]/execglob \ -tails -types x *] removeFile execglob/abc.exe removeFile execglob/abc.notexecutable removeDirectory execglob set res} {abc.exe}# cleanupcatch {file delete -force C:/globTest}cd [temporaryDirectory]file delete -force globTestcd $oldpwdset env(HOME) $oldhomeif {[tcltest::testConstraint testsetplatform]} { testsetplatform $platform catch {unset platform}}catch {unset oldhome temp result globPreResult}::tcltest::cleanupTestsreturn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -