winfcmd.test

来自「tcl是工具命令语言」· TEST 代码 · 共 1,003 行 · 第 1/3 页

TEST
1,003
字号
    testfile rmdir -force td1    file exists td1} {0}test winFCmd-7.7 {TraverseWinTree: append \ to source if necessary} {pcOnly} {    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} {pcOnly 95 cdrom} {    # cdrom can return either d:\ or D:/, but we only care about the errcode    list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1]} {1 EEXIST}test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {pcOnly nt cdrom} {    list [catch {testfile rmdir $cdrom/} msg]  [lindex $msg 1]} {1 EACCES}test winFCmd-7.10 {TraverseWinTree: can't read directory: handle == INVALID} \	{pcOnly} {    # can't make it happen} {}test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly 95} {    cleanup    file mkdir td1    list [catch {testfile cpdir td1 /} msg] $msg} {1 {/ EEXIST}}test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {pcOnly nt} {    cleanup    file mkdir td1    list [catch {testfile cpdir td1 /} msg] $msg} {1 {/ EACCES}}test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} {pcOnly} {    cleanup    file mkdir td1    testfile cpdir td1 td2} {}test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} {pcOnly} {    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} \	{pcOnly} {    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    lsort [glob td2/*]} {td2/td2 td2/tf1 td2/tf2 td2/tf3 td2/tf4}test winFCmd-7.19 {TraverseWinTree: call TraversalCopy: DOTREE_POSTD} {pcOnly} {    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} \	{pcOnly} {    cleanup    file mkdir td1    createfile td1/tf1 tf1    testfile rmdir -force td1    file exists td1} {0}test winFCmd-7.21 {TraverseWinTree: fill errorPtr} {pcOnly} {    cleanup    list [catch {testfile cpdir td1 td2} msg] $msg} {1 {td1 ENOENT}}test winFCmd-8.1 {TraversalCopy: DOTREE_F} {pcOnly} {    cleanup    file mkdir td1    list [catch {testfile cpdir td1 td1} msg] $msg} {1 {td1 EEXIST}}test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} {pcOnly} {    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} {pcOnly} {    cleanup    file mkdir td1    testfile cpdir td1 td2} {}test winFCmd-9.1 {TraversalDelete: DOTREE_F} {pcOnly} {    cleanup    file mkdir td1    createfile td1/tf1    testfile rmdir -force td1} {}test winFCmd-9.2 {TraversalDelete: DOTREE_F} {pcOnly 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} {pcOnly} {    cleanup    file mkdir td1/td2    testchmod 000 td1    testfile rmdir -force td1    file exists td1} {0}test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} {pcOnly} {    cleanup    file mkdir td1/td1/td3/td4/td5    testfile rmdir -force td1} {}test winFCmd-10.1 {AttributesPosixError - get} {pcOnly} {    cleanup    list [catch {file attributes td1 -archive} msg] $msg} {1 {could not read "td1": no such file or directory}}test winFCmd-10.2 {AttributesPosixError - set} {pcOnly} {    cleanup    list [catch {file attributes td1 -archive 0} msg] $msg} {1 {could not read "td1": no such file or directory}}test winFCmd-11.1 {GetWinFileAttributes} {pcOnly} {    cleanup    close [open td1 w]    list [catch {file attributes td1 -archive} msg] $msg [cleanup]} {0 1 {}}test winFCmd-11.2 {GetWinFileAttributes} {pcOnly} {    cleanup    close [open td1 w]    list [catch {file attributes td1 -readonly} msg] $msg [cleanup]} {0 0 {}}test winFCmd-11.3 {GetWinFileAttributes} {pcOnly} {    cleanup    close [open td1 w]    list [catch {file attributes td1 -hidden} msg] $msg [cleanup]} {0 0 {}}test winFCmd-11.4 {GetWinFileAttributes} {pcOnly} {    cleanup    close [open td1 w]    list [catch {file attributes td1 -system} msg] $msg [cleanup]} {0 0 {}}test winFCmd-11.5 {GetWinFileAttributes} {pcOnly} {    # attr of relative paths that resolve to root was failing    # don't care about answer, just that test runs.    set old [pwd]    cd c:/    file attr c:	        file attr c:.    file attr .     cd $old} {}test winFCmd-11.6 {GetWinFileAttributes} {pcOnly} {    file attr c:/ -hidden} {0}test winFCmd-12.1 {ConvertFileNameFormat} {pcOnly} {    cleanup    close [open td1 w]    list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-12.2 {ConvertFileNameFormat} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    list [file attributes / -longname] [file attributes \\ -longname]} {/ /}test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} {pcOnly} {    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} {nonPortable pcOnly} {    string tolower [file attributes //bisque/tcl/ws -longname]} {//bisque/tcl/ws}test winFCmd-12.8 {ConvertFileNameFormat} {pcOnly longFileNames} {    cleanup    close [open td1 w]    list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-12.10 {ConvertFileNameFormat} {longFileNames pcOnly} {    cleanup    close [open td1td1td1 w]    list [catch {file attributes td1td1td1 -shortname}] [cleanup]} {0 {}}test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames pcOnly} {    cleanup    close [open td1 w]    list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-13.1 {GetWinFileLongName} {pcOnly} {    cleanup    close [open td1 w]    list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-14.1 {GetWinFileShortName} {pcOnly} {    cleanup    close [open td1 w]    list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]} {0 td1 {}}test winFCmd-15.1 {SetWinFileAttributes} {pcOnly} {    cleanup    list [catch {file attributes td1 -archive 0} msg] $msg} {1 {could not read "td1": no such file or directory}}test winFCmd-15.2 {SetWinFileAttributes - archive} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly} {    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} {pcOnly cdrom} {    cleanup    catch {file attributes $cdfile -archive 1}} {1}test winFCmd-16.1 {Windows file normalization} {pcOnly} {    list [file normalize c:/] [file normalize C:/]} {C:/ C:/}# This block of code used to occur after the "return" call, so I'm# commenting it out and assuming that this code is still under construction.#foreach 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#		}#	    }#	}#    }#}# cleanupcleanup::tcltest::cleanupTestsreturn

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?