📄 winfcmd.test
字号:
cleanup set fd [open tf1 w] set msg [list [catch {testfile rm tf1} msg] $msg] close $fd set msg} {1 EACCES}test winFCmd-3.10 {TclpDeleteFile: path is readonly} { cleanup createfile tf1 testchmod 000 tf1 testfile rm tf1 file exists tf1} {0}test winFCmd-3.11 {TclpDeleteFile: still can't remove path} { cleanup set fd [open tf1 w] testchmod 000 tf1 set msg [list [catch {testfile rm tf1} msg] $msg] close $fd set msg} {1 EACCES}test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} {cdrom nt} { list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg} {1 EACCES}test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} {cdrom 95} { list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg} {1 ENOSPC}test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} { cleanup file mkdir td1 list [catch {testfile mkdir td1} msg] $msg} {1 EEXIST}test winFCmd-4.4 {TclpCreateDirectory: errno: ENOENT} { cleanup list [catch {testfile mkdir td1/td2} msg] $msg} {1 ENOENT}test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} { cleanup testfile mkdir td1 file type td1} {directory}test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} { cleanup file mkdir td1 testfile cpdir td1 td2 list [file type td1] [file type td2]} {directory directory}test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} { cleanup file mkdir td1 testchmod 000 td1 testfile rmdir td1 file exist td1} {0}test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} { cleanup file mkdir td1/td2 list [catch {testfile rmdir td1} msg] $msg} {1 {td1 EEXIST}}test winFCmd-6.3 {TclpRemoveDirectory: errno: EACCES} { # can't test this w/o removing everything on your hard disk first! # testfile rmdir /} {}test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} { cleanup list [catch {testfile rmdir td1} msg] $msg} {1 {td1 ENOENT}}test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} { cleanup list [catch {testfile rmdir ""} msg] $msg} {1 ENOENT}test winFCmd-6.6 {TclpRemoveDirectory: errno: ENOTDIR} { cleanup createfile tf1 list [catch {testfile rmdir tf1} msg] $msg} {1 {tf1 ENOTDIR}}test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} { cleanup file mkdir td1 testfile rmdir td1 file exists td1} {0}test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} { cleanup createfile tf1 list [catch {testfile rmdir tf1} msg] $msg} {1 {tf1 ENOTDIR}}test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} { cleanup file mkdir td1 testchmod 000 td1 testfile rmdir td1 file exists td1} {0}test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} {!nt} { cleanup list [catch {testfile rmdir nul} msg] $msg} {1 {nul EACCES}}test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} {nt} { cleanup list [catch {testfile rmdir /} msg] $msg} {1 {\ EACCES}}test winFCmd-6.12 {TclpRemoveDirectory: errno == EACCES} {!nt} { cleanup createfile tf1 list [catch {testfile rmdir tf1} msg] $msg} {1 {tf1 ENOTDIR}}test winFCmd-6.13 {TclpRemoveDirectory: write-protected} { cleanup file mkdir td1 testchmod 000 td1 testfile rmdir td1 file exists td1} {0}test winFCmd-6.14 {TclpRemoveDirectory: check if empty dir} {!nt} { cleanup file mkdir td1/td2 list [catch {testfile rmdir td1} msg] $msg} {1 {td1 EEXIST}}test winFCmd-6.15 {TclpRemoveDirectory: !recursive} { cleanup file mkdir td1/td2 list [catch {testfile rmdir td1} msg] $msg} {1 {td1 EEXIST}}test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} { cleanup createfile tf1 list [catch {testfile rmdir -force tf1} msg] $msg} {1 {tf1 ENOTDIR}}test winFCmd-6.17 {TclpRemoveDirectory: calls TraverseWinTree} { cleanup file mkdir td1/td2 testfile rmdir -force td1 file exists td1} {0}test winFCmd-7.1 {TraverseWinTree: targetPtr == NULL} { cleanup file mkdir td1/td2/td3 testfile rmdir -force td1 file exists td1} {0}test winFCmd-7.2 {TraverseWinTree: targetPtr != NULL} { cleanup file mkdir td1/td2/td3 testfile cpdir td1 td2 list [file exists td1] [file exists td2]} {1 1}test winFCmd-7.3 {TraverseWinTree: sourceAttr == -1} { cleanup list [catch {testfile cpdir td1 td2} msg] $msg} {1 {td1 ENOENT}}test winFCmd-7.4 {TraverseWinTree: source isn't directory} { cleanup file mkdir td1 createfile td1/tf1 tf1 testfile cpdir td1 td2 contents td2/tf1} {tf1}test winFCmd-7.5 {TraverseWinTree: call TraversalCopy: DOTREE_F} { cleanup file mkdir td1 createfile td1/tf1 tf1 testfile cpdir td1 td2 contents td2/tf1} {tf1}test winFCmd-7.6 {TraverseWinTree: call TraversalDelete: DOTREE_F} { cleanup file mkdir td1 createfile td1/tf1 tf1 testfile rmdir -force td1 file exists td1} {0}test winFCmd-7.7 {TraverseWinTree: append \ to source if necessary} { cleanup file mkdir td1 createfile td1/tf1 tf1 testfile cpdir td1 td2 contents td2/tf1} {tf1} test winFCmd-7.8 {TraverseWinTree: append \ to source if necessary} {!nt && cdrom} { list [catch {testfile rmdir $cdrom/} msg] $msg} "1 {$cdrom\\ EEXIST}"test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {nt cdrom} { list [catch {testfile rmdir $cdrom/} msg] $msg} "1 {$cdrom\\ EACCES}"test winFCmd-7.10 {TraverseWinTree: can't read directory: handle == INVALID} { # can't make it happen} {}test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} { cleanup file mkdir td1 testchmod 000 td1 createfile td1/tf1 tf1 testfile cpdir td1 td2 list [file exists td2] [file writable td2]} {1 0}test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} { cleanup file mkdir td1 createfile td1/tf1 tf1 testfile rmdir -force td1 file exists td1} {0}test winFCmd-7.13 {TraverseWinTree: append \ to target if necessary} { cleanup file mkdir td1 createfile td1/tf1 tf1 testfile cpdir td1 td2 contents td2/tf1} {tf1} test winFCmd-7.14 {TraverseWinTree: append \ to target if necessary} {!nt} { cleanup file mkdir td1 list [catch {testfile cpdir td1 /} msg] $msg} {1 {\ EEXIST}}test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {nt} { cleanup file mkdir td1 list [catch {testfile cpdir td1 /} msg] $msg} {1 {\ EACCES}}test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} { cleanup file mkdir td1 testfile cpdir td1 td2} {}test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} { cleanup file mkdir td1 createfile td1/td2 testfile cpdir td1 td2 glob td2/*} {td2/td2}test winFCmd-7.18 {TraverseWinTree: recurse on files: several files and dir} { cleanup file mkdir td1 createfile td1/tf1 createfile td1/tf2 file mkdir td1/td2/td3 createfile td1/tf3 createfile td1/tf4 testfile cpdir td1 td2 glob td2/*} {td2/tf1 td2/tf2 td2/td2 td2/tf3 td2/tf4}test winFCmd-7.19 {TraverseWinTree: call TraversalCopy: DOTREE_POSTD} { cleanup file mkdir td1 testchmod 000 td1 createfile td1/tf1 tf1 testfile cpdir td1 td2 list [file exists td2] [file writable td2]} {1 0}test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} { cleanup file mkdir td1 createfile td1/tf1 tf1 testfile rmdir -force td1 file exists td1} {0}test winFCmd-7.21 {TraverseWinTree: fill errorPtr} { cleanup list [catch {testfile cpdir td1 td2} msg] $msg} {1 {td1 ENOENT}}test winFCmd-8.1 {TraversalCopy: DOTREE_F} { cleanup file mkdir td1 list [catch {testfile cpdir td1 td1} msg] $msg} {1 {td1 EEXIST}}test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} { cleanup file mkdir td1/td2 testchmod 000 td1 testfile cpdir td1 td2 list [file writable td1] [file writable td1/td2]} {0 1}test winFCmd-8.3 {TraversalCopy: DOTREE_POSTD} { cleanup file mkdir td1 testfile cpdir td1 td2} {}test winFCmd-9.1 {TraversalDelete: DOTREE_F} { cleanup file mkdir td1 createfile td1/tf1 testfile rmdir -force td1} {}test winFCmd-9.2 {TraversalDelete: DOTREE_F} {95} { cleanup file mkdir td1 set fd [open td1/tf1 w] set msg [list [catch {testfile rmdir -force td1} msg] $msg] close $fd set msg} {1 {td1\tf1 EACCES}}test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} { cleanup file mkdir td1/td2 testchmod 000 td1 testfile rmdir -force td1 file exists td1} {0}test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} { cleanup file mkdir td1/td1/td3/td4/td5 testfile rmdir -force td1} {}test winFCmd-10.1 {AttributesPosixError - get} { cleanup list [catch {file attributes td1 -archive} msg] $msg} {1 {cannot get attribute "-archive" for file "td1": no such file or directory}}test winFCmd-10.2 {AttributesPosixError - set} { cleanup list [catch {file attributes td1 -archive 0} msg] $msg} {1 {cannot set attribute "-archive" for file "td1": no such file or directory}}test winFCmd-11.1 {GetWinFileAttributes} { cleanup close [open td1 w] list [catch {file attributes td1 -archive} msg] $msg [cleanup]} {0 1 {}}test winFCmd-11.2 {GetWinFileAttributes} { cleanup close [open td1 w] list [catch {file attributes td1 -readonly} msg] $msg [cleanup]} {0 0 {}}test winFCmd-11.3 {GetWinFileAttributes} { cleanup close [open td1 w] list [catch {file attributes td1 -hidden} msg] $msg [cleanup]} {0 0 {}}test winFCmd-11.4 {GetWinFileAttributes} { cleanup close [open td1 w] list [catch {file attributes td1 -system} msg] $msg [cleanup]} {0 0 {}}test winFCmd-12.1 {ConvertFileNameFormat} { cleanup close [open td1 w] list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-12.2 {ConvertFileNameFormat} { cleanup file mkdir td1 close [open td1/td1 w] list [catch {string tolower [file attributes td1/td1 -longname]} msg] $msg [cleanup]} {0 td1/td1 {}}test winFCmd-12.3 {ConvertFileNameFormat} { cleanup file mkdir td1 file mkdir td1/td2 close [open td1/td3 w] list [catch {string tolower [file attributes td1/td2/../td3 -longname]} msg] $msg [cleanup]} {0 td1/td2/../td3 {}}test winFCmd-12.4 {ConvertFileNameFormat} { cleanup close [open td1 w] list [catch {string tolower [file attributes ./td1 -longname]} msg] $msg [cleanup]} {0 ./td1 {}}test winFCmd-12.5 {ConvertFileNameFormat: absolute path} { list [file attributes / -longname] [file attributes \\ -longname]} {/ /}test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} { catch {file delete -force -- c:/td1} close [open c:/td1 w] list [catch {string tolower [file attributes c:/td1 -longname]} msg] $msg [file delete -force -- c:/td1]} {0 c:/td1 {}}test winFCmd-12.7 {ConvertFileNameFormat} {UNCPath} { catch {file delete -force -- //bisque/icepick/test/td1} close [open //bisque/icepick/test/td1 w] list [catch {string tolower [file attributes //bisque/icepick/test/td1 -longname]} msg] $msg [file delete -force -- //bisque/icepick/test/td1]} {0 //bisque/icepick/test/td1 {}}test winFCmd-12.8 {ConvertFileNameFormat} {longFileNames} { cleanup close [open td1 w] list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-12.9 {ConvertFileNameFormat} {win32s} { cleanup close [open td1 w] list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-12.10 {ConvertFileNameFormat} {longFileNames} { cleanup close [open td1td1td1 w] list [catch {file attributes td1td1td1 -shortname}] [cleanup]} {0 {}}test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames} { cleanup close [open td1 w] list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-13.1 {GetWinFileLongName} { cleanup close [open td1 w] list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-14.1 {GetWinFileShortName} { cleanup close [open td1 w] list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-15.1 {SetWinFileAttributes} { cleanup list [catch {file attributes td1 -archive 0} msg] $msg} {1 {cannot set attribute "-archive" for file "td1": no such file or directory}}test winFCmd-15.2 {SetWinFileAttributes - archive} { cleanup close [open td1 w] list [catch {file attributes td1 -archive 1} msg] $msg [file attributes td1 -archive] [cleanup]} {0 {} 1 {}}test winFCmd-15.3 {SetWinFileAttributes - archive} { cleanup close [open td1 w] list [catch {file attributes td1 -archive 0} msg] $msg [file attributes td1 -archive] [cleanup]} {0 {} 0 {}}test winFCmd-15.4 {SetWinFileAttributes - hidden} { cleanup close [open td1 w] list [catch {file attributes td1 -hidden 1} msg] $msg [file attributes td1 -hidden] [file attributes td1 -hidden 0] [cleanup]} {0 {} 1 {} {}}test winFCmd-15.5 {SetWinFileAttributes - hidden} { cleanup close [open td1 w] list [catch {file attributes td1 -hidden 0} msg] $msg [file attributes td1 -hidden] [cleanup]} {0 {} 0 {}}test winFCmd-15.6 {SetWinFileAttributes - readonly} { cleanup close [open td1 w] list [catch {file attributes td1 -readonly 1} msg] $msg [file attributes td1 -readonly] [cleanup]} {0 {} 1 {}}test winFCmd-15.7 {SetWinFileAttributes - readonly} { cleanup close [open td1 w] list [catch {file attributes td1 -readonly 0} msg] $msg [file attributes td1 -readonly] [cleanup]} {0 {} 0 {}}test winFCmd-15.8 {SetWinFileAttributes - system} { cleanup close [open td1 w] list [catch {file attributes td1 -system 1} msg] $msg [file attributes td1 -system] [cleanup]} {0 {} 1 {}}test winFCmd-15.9 {SetWinFileAttributes - system} { cleanup close [open td1 w] list [catch {file attributes td1 -system 0} msg] $msg [file attributes td1 -system] [cleanup]} {0 {} 0 {}}test winFCmd-15.10 {SetWinFileAttributes - failing} {cdrom} { cleanup catch {file attributes $cdfile -archive 1}} {1}cleanupreturnforeach source {tef ted tnf tnd "" nul com1} { foreach chmodsrc {000 755} { foreach dest "tfn tfe tdn tdempty tdfull td1/td2 $p $p/td1 {} nul" { foreach chmoddst {000 755} { puts hi cleanup file delete -force ted tef file mkdir ted createfile tef createfile tfe file mkdir tdempty file mkdir tdfull/td1/td2 catch {testchmod $chmodsrc $source} catch {testchmod $chmoddst $dest} if [catch {file rename $source $dest} msg] { puts "file rename $source ($chmodsrc) $dest ($chmoddst)" puts $msg } } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -