📄 filename.test
字号:
close [open globTest/x1.c w]close [open globTest/y1.c w]close [open globTest/z1.c w]close [open "globTest/weird name.c" w]close [open globTest/a1/b1/x2.c w]close [open globTest/a1/b2/y2.c w]catch {close [open globTest/.1 w]}catch {close [open globTest/x,z1.c w]}test filename-11.14 {Tcl_GlobCmd} { list [catch {glob ~/globTest} msg] $msg} [list 0 [list [file join $env(HOME) globTest]]]test filename-11.15 {Tcl_GlobCmd} { list [catch {glob ~\\/globTest} msg] $msg} [list 0 [list [file join $env(HOME) globTest]]]test filename-11.16 {Tcl_GlobCmd} { list [catch {glob globTest} msg] $msg} {0 globTest}set globname "globTest"set horribleglobname "glob\[\{Test"test filename-11.17 {Tcl_GlobCmd} {unixOnly} { list [catch {lsort [glob -directory $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ [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-11.17.1 {Tcl_GlobCmd} {pcOnly macOnly} { list [catch {lsort [glob -directory $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname .1]\ [file join $globname a3]\ [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]]]]if {[string equal $tcl_platform(platform) "windows"]} { if {[string index $tcl_platform(osVersion) 0] >= 5 \ && ([lindex [file system [temporaryDirectory]] 1] == "NTFS")} { tcltest::testConstraint linkDirectory 1 } else { tcltest::testConstraint linkDirectory 0 }} else { tcltest::testConstraint linkDirectory 1}if {[string equal $tcl_platform(platform) "windows"]} { tcltest::testConstraint symbolicLinkFile 0} else { tcltest::testConstraint symbolicLinkFile 1}test filename-11.17.2 {Tcl_GlobCmd} {notRoot linkDirectory} { set dir [pwd] set ret "error in test" if {[catch { cd $globname file link -symbolic link a1 cd $dir set ret [list [catch { lsort [glob -directory $globname -join * b1] } msg] $msg] }]} { cd $dir } file delete [file join $globname link] set ret} [list 0 [lsort [list [file join $globname a1 b1] \ [file join $globname link b1]]]]# Simpler version of the above test to illustrate a given bug.test filename-11.17.3 {Tcl_GlobCmd} {notRoot linkDirectory} { set dir [pwd] set ret "error in test" if {[catch { cd $globname file link -symbolic link a1 cd $dir set ret [list [catch { lsort [glob -directory $globname -type d *] } msg] $msg] }]} { cd $dir } file delete [file join $globname link] set ret} [list 0 [lsort [list [file join $globname a1] \ [file join $globname a2] \ [file join $globname a3] \ [file join $globname link]]]]# Make sure the bugfix isn't too simple. We don't want# to break 'glob -type l'.test filename-11.17.4 {Tcl_GlobCmd} {notRoot linkDirectory} { set dir [pwd] set ret "error in test" if {[catch { cd $globname file link -symbolic link a1 cd $dir set ret [list [catch { lsort [glob -directory $globname -type l *] } msg] $msg] }]} { cd $dir } file delete [file join $globname link] set ret} [list 0 [list [file join $globname link]]]test filename-11.17.5 {Tcl_GlobCmd} { list [catch {lsort [glob -directory $globname -tails *.c]} msg] $msg} [list 0 [lsort [list "weird name.c" x,z1.c x1.c y1.c z1.c]]]test filename-11.17.6 {Tcl_GlobCmd} { list [catch {lsort [glob -directory $globname -tails *.c *.c]} msg] $msg} [list 0 [lsort [concat [list "weird name.c" x,z1.c x1.c y1.c z1.c] \ [list "weird name.c" x,z1.c x1.c y1.c z1.c]]]]test filename-11.17.7 {Tcl_GlobCmd: broken link and glob -l} {linkDirectory} { set dir [pwd] set ret "error in test" if {[catch { cd $globname file mkdir nonexistent file link -symbolic link nonexistent file delete nonexistent cd $dir set ret [list [catch { lsort [glob -nocomplain -directory $globname -type l *] } msg] $msg] }]} { cd $dir } file delete [file join $globname link] set ret} [list 0 [list [file join $globname link]]]test filename-11.17.8 {Tcl_GlobCmd: broken link and glob -l} {symbolicLinkFile} { set dir [pwd] set ret "error in test" if {[catch { cd $globname close [open "nonexistent" w] file link -symbolic link nonexistent file delete nonexistent cd $dir set ret [list [catch { lsort [glob -nocomplain -directory $globname -type l *] } msg] $msg] }]} { cd $dir } file delete [file join $globname link] set ret} [list 0 [list [file join $globname link]]]test filename-11.18 {Tcl_GlobCmd} {unixOnly} { list [catch {lsort [glob -path $globname/ *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ [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-11.18.1 {Tcl_GlobCmd} {pcOnly macOnly} { list [catch {lsort [glob -path $globname/ *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname .1]\ [file join $globname a3]\ [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-11.19 {Tcl_GlobCmd} {unixOnly} { list [catch {lsort [glob -join -path \ [string range $globname 0 5] * *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ [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-11.19.1 {Tcl_GlobCmd} {pcOnly macOnly} { list [catch {lsort [glob -join -path \ [string range $globname 0 5] * *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname .1]\ [file join $globname a3]\ [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-11.20 {Tcl_GlobCmd} { list [catch {lsort [glob -type d -dir $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1]\ [file join $globname a2]\ [file join $globname a3]]]]test filename-11.21 {Tcl_GlobCmd} { list [catch {lsort [glob -type d -path $globname *]} msg] $msg} [list 0 [lsort [list $globname]]]# Get rid of file/dir if it exists, since it will have# been left behind by a previous failed run.if {[file exists $horribleglobname]} { file delete -force $horribleglobname}file rename globTest $horribleglobnameset globname $horribleglobnametest filename-11.22 {Tcl_GlobCmd} {unixOnly} { list [catch {lsort [glob -dir $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ [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-11.22.1 {Tcl_GlobCmd} {pcOnly macOnly} { list [catch {lsort [glob -dir $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname .1]\ [file join $globname a3]\ [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-11.23 {Tcl_GlobCmd} {unixOnly} { list [catch {lsort [glob -path $globname/ *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ [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-11.23.1 {Tcl_GlobCmd} {pcOnly macOnly} { list [catch {lsort [glob -path $globname/ *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname .1]\ [file join $globname a3]\ [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-11.24 {Tcl_GlobCmd} {unixOnly} { list [catch {lsort [glob -join -path \ [string range $globname 0 5] * *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname a3]\ [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-11.24.1 {Tcl_GlobCmd} {pcOnly macOnly} { list [catch {lsort [glob -join -path \ [string range $globname 0 5] * *]} msg] $msg} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\ [file join $globname .1]\ [file join $globname a3]\ [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-11.25 {Tcl_GlobCmd} { list [catch {lsort [glob -type d -dir $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1]\ [file join $globname a2]\ [file join $globname a3]]]]test filename-11.25.1 {Tcl_GlobCmd} { list [catch {lsort [glob -type {d r} -dir $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1]\ [file join $globname a2]\ [file join $globname a3]]]]test filename-11.25.2 {Tcl_GlobCmd} { list [catch {lsort [glob -type {d r w} -dir $globname *]} msg] $msg} [list 0 [lsort [list [file join $globname a1]\ [file join $globname a2]\ [file join $globname a3]]]]test filename-11.26 {Tcl_GlobCmd} { list [catch {glob -type d -path $globname *} msg] $msg} [list 0 [list $globname]]test filename-11.27 {Tcl_GlobCmd} { list [catch {glob -types abcde *} msg] $msg} {1 {bad argument to "-types": abcde}}test filename-11.28 {Tcl_GlobCmd} { list [catch {glob -types z *} msg] $msg} {1 {bad argument to "-types": z}}test filename-11.29 {Tcl_GlobCmd} { list [catch {glob -types {abcd efgh} *} msg] $msg} {1 {only one MacOS type or creator argument to "-types" allowed}}test filename-11.30 {Tcl_GlobCmd} { list [catch {glob -types {{macintosh type TEXT} \ {macintosh creator ALFA} efgh} *} msg] $msg} {1 {only one MacOS type or creator argument to "-types" allowed}}test filename-11.31 {Tcl_GlobCmd} { list [catch {glob -types} msg] $msg} {1 {missing argument to "-types"}}test filename-11.32 {Tcl_GlobCmd} { list [catch {glob -path hello -dir hello *} msg] $msg} {1 {"-directory" cannot be used with "-path"}}test filename-11.33 {Tcl_GlobCmd} { list [catch {glob -path} msg] $msg} {1 {missing argument to "-path"}}test filename-11.34 {Tcl_GlobCmd} { list [catch {glob -direct} msg] $msg} {1 {missing argument to "-directory"}}test filename-11.35 {Tcl_GlobCmd} { list [catch {glob -paths *} msg] $msg} {1 {bad option "-paths": must be -directory, -join, -nocomplain, -path, -tails, -types, or --}}# Test '-tails' flag to glob.test filename-11.36 {Tcl_GlobCmd} { list [catch {glob -tails *} msg] $msg} {1 {"-tails" must be used with either "-directory" or "-path"}}test filename-11.37 {Tcl_GlobCmd} { list [catch {glob -type d -tails -path $globname *} msg] $msg} [list 0 [list $globname]]test filename-11.38 {Tcl_GlobCmd} { list [catch {glob -tails -path $globname *} msg] $msg} [list 0 [list $globname]]test filename-11.39 {Tcl_GlobCmd} { list [catch {glob -tails -join -path $globname *} msg] $msg} [list 0 [list $globname]]test filename-11.40 {Tcl_GlobCmd} { expr {[glob -dir [pwd] -tails *] == [glob *]}} {1}test filename-11.41 {Tcl_GlobCmd} { expr {[glob -dir [pwd] -tails *] != [glob -dir [pwd] *]}} {1}test filename-11.42 {Tcl_GlobCmd} { set res [list] foreach f [glob -dir [pwd] *] { lappend res [file tail $f] } expr {$res == [glob *]}} {1}test filename-11.43 {Tcl_GlobCmd} { list [catch {glob -t *} msg] $msg} {1 {ambiguous option "-t": must be -directory, -join, -nocomplain, -path, -tails, -types, or --}}test filename-11.44 {Tcl_GlobCmd} { list [catch {glob -tails -path hello -directory hello *} msg] $msg} {1 {"-directory" cannot be used with "-path"}}test filename-11.45 {Tcl_GlobCmd on root volume} { set res1 "" set res2 "" catch { set res1 [glob -dir [lindex [file volumes] 0] -tails *] } catch { set tmpd [pwd] cd [lindex [file volumes] 0] set res2 [glob *] cd $tmpd } expr {$res1 == $res2}} {1}test filename-11.46 {Tcl_GlobCmd} { list [catch {glob -types abcde -dir foo *} msg] $msg} {1 {bad argument to "-types": abcde}}test filename-11.47 {Tcl_GlobCmd} { list [catch {glob -types abcde -path foo *} msg] $msg} {1 {bad argument to "-types": abcde}}test filename-11.48 {Tcl_GlobCmd} { list [catch {glob -types abcde -dir foo -join * *} msg] $msg} {1 {bad argument to "-types": abcde}}test filename-11.49 {Tcl_GlobCmd} { list [catch {glob -types abcde -path foo -join * *} msg] $msg} {1 {bad argument to "-types": abcde}}file rename $horribleglobname globTestset globname globTestunset horribleglobnametest filename-12.1 {simple globbing} {unixOrPc} { list [catch {glob {}} msg] $msg} {0 .}test filename-12.1.1 {simple globbing} {unixOrPc} { list [catch {glob -types f {}} msg] $msg} {1 {no files matched glob pattern ""}}test filename-12.1.2 {simple globbing} {unixOrPc} { list [catch {glob -types d {}} msg] $msg} {0 .}test filename-12.1.3 {simple globbing} {unixOnly} { list [catch {glob -types hidden {}} msg] $msg
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -