summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fCmd.test38
-rw-r--r--tests/unixFCmd.test818
-rw-r--r--tests/winFCmd.test1333
-rw-r--r--tests/winFile.test90
4 files changed, 1276 insertions, 1003 deletions
diff --git a/tests/fCmd.test b/tests/fCmd.test
index ececb2e..3bf6487 100644
--- a/tests/fCmd.test
+++ b/tests/fCmd.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: fCmd.test,v 1.60 2008/03/28 11:18:48 dkf Exp $
+# RCS: @(#) $Id: fCmd.test,v 1.61 2008/04/10 00:21:02 dkf Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -24,6 +24,7 @@ testConstraint testchmod [llength [info commands testchmod]]
testConstraint notNetworkFilesystem 0
testConstraint 95or98 [expr {[testConstraint 95] || [testConstraint 98]}]
testConstraint 2000orNewer [expr {![testConstraint 95or98]}]
+testConstraint registryPackage [expr {![catch {package require registry}]}]
# Find a group that exists on this Unix system, or else skip tests that
# require Unix groups.
@@ -1116,7 +1117,7 @@ cleanup
# old tests
-test fCmd-11.1 {TclFileRenameCmd: -- option } -constraints notRoot -setup {
+test fCmd-11.1 {TclFileRenameCmd: -- option} -constraints notRoot -setup {
catch {file delete -force -- -tfa1}
} -body {
set s [createfile -tfa1]
@@ -1125,7 +1126,7 @@ test fCmd-11.1 {TclFileRenameCmd: -- option } -constraints notRoot -setup {
} -cleanup {
file delete tfa2
} -result {1 0}
-test fCmd-11.2 {TclFileRenameCmd: bad option } -constraints notRoot -setup {
+test fCmd-11.2 {TclFileRenameCmd: bad option} -constraints notRoot -setup {
catch {file delete -force -- tfa1}
} -body {
set s [createfile tfa1]
@@ -1135,7 +1136,7 @@ test fCmd-11.2 {TclFileRenameCmd: bad option } -constraints notRoot -setup {
file delete tfa1
} -result {1 1 0}
test fCmd-11.3 {TclFileRenameCmd: bad \# args} {
- catch {file rename -- }
+ catch {file rename --}
} {1}
test fCmd-11.4 {TclFileRenameCmd: target filename translation failing} -setup {
set temp $::env(HOME)
@@ -1320,7 +1321,7 @@ test fCmd-13.3 {TclCopyFilesCmd: bad option} -constraints {notRoot} -setup {
file delete tfa1
} -result {1 1 0}
test fCmd-13.4 {TclCopyFilesCmd: bad \# args} {notRoot} {
- catch {file copy -- }
+ catch {file copy --}
} {1}
test fCmd-13.5 {TclCopyFilesCmd: target filename translation failing} -setup {
set temp $::env(HOME)
@@ -1354,8 +1355,8 @@ test fCmd-13.7 {TclCopyFilesCmd: single file into directory} -setup {
test fCmd-13.8 {TclCopyFilesCmd: multiple files into directory} -setup {
catch {file delete -force -- tfa1 tfa2 tfad}
} -constraints {notRoot} -body {
- set s1 [createfile tfa1 ]
- set s2 [createfile tfa2 ]
+ set s1 [createfile tfa1]
+ set s2 [createfile tfa2]
file mkdir tfad
file copy tfa1 tfa2 tfad
list [checkcontent tfad/tfa1 $s1] [checkcontent tfad/tfa2 $s2] \
@@ -1407,7 +1408,7 @@ test fCmd-14.3 {copyfile: stat failing on source} -setup {
test fCmd-14.4 {copyfile: error copying file to directory} -setup {
catch {file delete -force -- tfa tfad}
} -constraints {notRoot} -body {
- set s1 [createfile tfa ]
+ set s1 [createfile tfa]
file mkdir tfad
file mkdir tfad/tfa
list [catch {file copy tfa tfad}] [checkcontent tfa $s1] \
@@ -1472,7 +1473,7 @@ test fCmd-15.1 {TclMakeDirsCmd: target filename translation failing} -setup {
# Can Tcl_SplitPath return argc == 0? If so them we need a
# test for that code.
#
-test fCmd-15.2 {TclMakeDirsCmd - one directory } -setup {
+test fCmd-15.2 {TclMakeDirsCmd - one directory} -setup {
catch {file delete -force -- tfa}
} -constraints {notRoot} -body {
file mkdir tfa
@@ -1658,7 +1659,7 @@ test fCmd-18.1 {TclFileRenameCmd: rename (first form) in the same directory} \
} -constraints {notRoot} -body {
file mkdir tfad/dir
cd tfad/dir
- set s [createfile foo ]
+ set s [createfile foo]
file rename foo bar
file rename bar ./foo
file rename ./foo bar
@@ -1861,7 +1862,7 @@ test fCmd-19.3 {recursive remove} -constraints {notRoot} -setup {
# Coverage tests for TraverseUnixTree(), called from TclDeleteFilesCmd
#
-test fCmd-20.1 {TraverseUnixTree : failure opening a subdirectory directory } -setup {
+test fCmd-20.1 {TraverseUnixTree : failure opening a subdirectory directory} -setup {
catch {file delete -force -- tfa}
} -constraints {unix notRoot} -body {
file mkdir tfa
@@ -2493,15 +2494,12 @@ removeFile abc.file
removeDirectory abc2.dir
removeDirectory abc.dir
-test fCmd-30.1 {file writable on 'My Documents'} -constraints {win 2000orNewer} -body {
- set mydocsname "~/My Documents"
- # Would be good to localise this name, since this test will only function
- # on english-speaking windows otherwise
- if {[file exists $mydocsname]} {
- return [file writable $mydocsname]
- }
- return 1
-} -result {1}
+test fCmd-30.1 {file writable on 'My Documents'} -setup {
+ # Get the localized version of the folder name by looking in the registry.
+ set mydocsname [registry get {HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths} $tcl_platform(user)]
+} -constraints {win 2000orNewer registryPackage} -body {
+ file writable $mydocsname
+} -result 1
test fCmd-30.2 {file readable on 'NTUSER.DAT'} -constraints {win 2000orNewer knownBug} -body {
# Apparently the OS has this file open with exclusive permissions Windows
# doesn't provide any way to determine that fact without actually trying
diff --git a/tests/unixFCmd.test b/tests/unixFCmd.test
index 20afe69..db57b9f 100644
--- a/tests/unixFCmd.test
+++ b/tests/unixFCmd.test
@@ -1,379 +1,439 @@
-# This file tests the tclUnixFCmd.c file.
-#
-# This file contains a collection of tests for one or more of the Tcl
-# built-in commands. Sourcing this file into Tcl runs the tests and
-# generates output for errors. No output means no errors were found.
-#
-# Copyright (c) 1996 Sun Microsystems, Inc.
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# RCS: @(#) $Id: unixFCmd.test,v 1.24 2006/03/21 11:12:29 dkf Exp $
-
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
- namespace import -force ::tcltest::*
-}
-
-testConstraint testchmod [llength [info commands testchmod]]
-
-# These tests really need to be run from a writable directory, which
-# it is assumed [temporaryDirectory] is.
-set oldcwd [pwd]
-cd [temporaryDirectory]
-
-# Several tests require need to match results against the unix username
-set user {}
-if {[testConstraint unix]} {
- catch {set user [exec whoami]}
- if {$user == ""} {
- catch {regexp {^[^(]*\(([^)]*)\)} [exec id] dummy user}
- }
- if {$user == ""} {
- set user "root"
- }
-}
-
-# Find a group that exists on this system, or else skip tests that require
-# groups
-testConstraint foundGroup 0
-if {[testConstraint unix]} {
- catch {
- set groupList [exec groups]
- set group [lindex $groupList 0]
- testConstraint foundGroup 1
- }
-}
-
-# check whether -readonly attribute is supported
-testConstraint readonlyAttr 0
-if {[testConstraint unix]} {
- set f [makeFile "whatever" probe]
- catch {
- file attributes $f -readonly
- testConstraint readonlyAttr 1
- }
- removeFile probe
-}
-
-proc openup {path} {
- testchmod 777 $path
- if {[file isdirectory $path]} {
- catch {
- foreach p [glob -directory $path *] {
- openup $p
- }
- }
- }
-}
-
-proc cleanup {args} {
- foreach p ". $args" {
- set x ""
- catch {
- set x [glob -directory $p tf* td*]
- }
- foreach file $x {
- if {
- [catch {file delete -force -- $file}]
- && [testConstraint testchmod]
- } then {
- openup $file
- file delete -force -- $file
- }
- }
- }
-}
-
-test unixFCmd-1.1 {TclpRenameFile: EACCES} {unix notRoot} {
- cleanup
- file mkdir td1/td2/td3
- file attributes td1/td2 -permissions 0000
- set msg [list [catch {file rename td1/td2/td3 td2} msg] $msg]
- file attributes td1/td2 -permissions 0755
- set msg
-} {1 {error renaming "td1/td2/td3": permission denied}}
-test unixFCmd-1.2 {TclpRenameFile: EEXIST} {unix notRoot} {
- cleanup
- file mkdir td1/td2
- file mkdir td2
- list [catch {file rename td2 td1} msg] $msg
-} {1 {error renaming "td2" to "td1/td2": file already exists}}
-test unixFCmd-1.3 {TclpRenameFile: EINVAL} {unix notRoot} {
- cleanup
- file mkdir td1
- list [catch {file rename td1 td1} msg] $msg
-} {1 {error renaming "td1" to "td1/td1": trying to rename a volume or move a directory into itself}}
-test unixFCmd-1.4 {TclpRenameFile: EISDIR} {emptyTest unix notRoot} {
- # can't make it happen
-} {}
-test unixFCmd-1.5 {TclpRenameFile: ENOENT} {unix notRoot} {
- cleanup
- file mkdir td1
- list [catch {file rename td2 td1} msg] $msg
-} {1 {error renaming "td2": no such file or directory}}
-test unixFCmd-1.6 {TclpRenameFile: ENOTDIR} {emptyTest unix notRoot} {
- # can't make it happen
-} {}
-test unixFCmd-1.7 {TclpRenameFile: EXDEV} {unix notRoot} {
- cleanup
- file mkdir foo/bar
- file attr foo -perm 040555
- set catchResult [catch {file rename foo/bar /tmp} msg]
- set msg [lindex [split $msg :] end]
- catch {file delete /tmp/bar}
- catch {file attr foo -perm 040777}
- catch {file delete -force foo}
- list $catchResult $msg
-} {1 { permission denied}}
-test unixFCmd-1.8 {Checking EINTR Bug} {unix notRoot nonPortable} {
- testalarm
- after 2000
- list [testgotsig] [testgotsig]
-} {1 0}
-test unixFCmd-1.9 {Checking EINTR Bug} {unix notRoot nonPortable} {
- cleanup
- set f [open tfalarm w]
- puts $f {
- after 2000
- puts "hello world"
- exit 0
- }
- close $f
- testalarm
- set pipe [open "|[info nameofexecutable] tfalarm" r+]
- set line [read $pipe 1]
- catch {close $pipe}
- list $line [testgotsig]
-} {h 1}
-
-test unixFCmd-2.1 {TclpCopyFile: target exists: lstat(dst) == 0} \
- {unix notRoot} {
- cleanup
- close [open tf1 a]
- close [open tf2 a]
- file copy -force tf1 tf2
-} {}
-test unixFCmd-2.2.1 {TclpCopyFile: src is symlink} {unix notRoot dontCopyLinks} {
- # copying links should end up with real files
- cleanup
- close [open tf1 a]
- file link -symbolic tf2 tf1
- file copy tf2 tf3
- file type tf3
-} {file}
-test unixFCmd-2.2.2 {TclpCopyFile: src is symlink} {unix notRoot} {
- # copying links should end up with the links copied
- cleanup
- close [open tf1 a]
- file link -symbolic tf2 tf1
- file copy tf2 tf3
- file type tf3
-} {link}
-test unixFCmd-2.3 {TclpCopyFile: src is block} {unix notRoot} {
- cleanup
- set null "/dev/null"
- while {[file type $null] != "characterSpecial"} {
- set null [file join [file dirname $null] [file readlink $null]]
- }
- # file copy $null tf1
-} {}
-test unixFCmd-2.4 {TclpCopyFile: src is fifo} {unix notRoot} {
- cleanup
- if [catch {exec mknod tf1 p}] {
- list 1
- } else {
- file copy tf1 tf2
- expr {"[file type tf1]" == "[file type tf2]"}
- }
-} {1}
-test unixFCmd-2.5 {TclpCopyFile: copy attributes} {unix notRoot} {
- cleanup
- close [open tf1 a]
- file attributes tf1 -permissions 0472
- file copy tf1 tf2
- file attributes tf2 -permissions
-} 00472 ;# i.e. perms field of [exec ls -l tf2] is -r--rwx-w-
-
-test unixFCmd-3.1 {CopyFile not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-4.1 {TclpDeleteFile not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-5.1 {TclpCreateDirectory not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-6.1 {TclpCopyDirectory not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-7.1 {TclpRemoveDirectory not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-8.1 {TraverseUnixTree not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-9.1 {TraversalCopy not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-10.1 {TraversalDelete not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-11.1 {CopyFileAttrs not done} {emptyTest unix notRoot} {
-} {}
-
-test unixFCmd-12.1 {GetGroupAttribute - file not found} {unix notRoot} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -group} msg] $msg
-} {1 {could not read "foo.test": no such file or directory}}
-test unixFCmd-12.2 {GetGroupAttribute - file found} {unix notRoot} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attributes foo.test -group}] [file delete -force -- foo.test]
-} {0 {}}
-
-test unixFCmd-13.1 {GetOwnerAttribute - file not found} {unix notRoot} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -group} msg] $msg
-} {1 {could not read "foo.test": no such file or directory}}
-test unixFCmd-13.2 {GetOwnerAttribute} {unix notRoot} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attributes foo.test -owner} msg] \
- [string compare $msg $user] [file delete -force -- foo.test]
-} {0 0 {}}
-
-test unixFCmd-14.1 {GetPermissionsAttribute - file not found} {unix notRoot} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -permissions} msg] $msg
-} {1 {could not read "foo.test": no such file or directory}}
-test unixFCmd-14.2 {GetPermissionsAttribute} {unix notRoot} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attribute foo.test -permissions}] \
- [file delete -force -- foo.test]
-} {0 {}}
-
-#groups hard to test
-test unixFCmd-15.1 {SetGroupAttribute - invalid group} {unix notRoot} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -group foozzz} msg] \
- $msg [file delete -force -- foo.test]
-} {1 {could not set group for file "foo.test": group "foozzz" does not exist} {}}
-test unixFCmd-15.2 {SetGroupAttribute - invalid file} \
- {unix notRoot foundGroup} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -group $group} msg] $msg
-} {1 {could not set group for file "foo.test": no such file or directory}}
-
-#changing owners hard to do
-test unixFCmd-16.1 {SetOwnerAttribute - current owner} {unix notRoot} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attributes foo.test -owner $user} msg] \
- $msg [string compare [file attributes foo.test -owner] $user] \
- [file delete -force -- foo.test]
-} {0 {} 0 {}}
-test unixFCmd-16.2 {SetOwnerAttribute - invalid file} {unix notRoot} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -owner $user} msg] $msg
-} {1 {could not set owner for file "foo.test": no such file or directory}}
-test unixFCmd-16.3 {SetOwnerAttribute - invalid owner} {unix notRoot} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -owner foozzz} msg] $msg
-} {1 {could not set owner for file "foo.test": user "foozzz" does not exist}}
-
-
-test unixFCmd-17.1 {SetPermissionsAttribute} {unix notRoot} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attributes foo.test -permissions 0000} msg] \
- $msg [file attributes foo.test -permissions] \
- [file delete -force -- foo.test]
-} {0 {} 00000 {}}
-test unixFCmd-17.2 {SetPermissionsAttribute} {unix notRoot} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -permissions 0000} msg] $msg
-} {1 {could not set permissions for file "foo.test": no such file or directory}}
-test unixFCmd-17.3 {SetPermissionsAttribute} {unix notRoot} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attributes foo.test -permissions foo} msg] $msg \
- [file delete -force -- foo.test]
-} {1 {unknown permission string format "foo"} {}}
-test unixFCmd-17.4 {SetPermissionsAttribute} {unix notRoot} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attributes foo.test -permissions ---rwx} msg] $msg \
- [file delete -force -- foo.test]
-} {1 {unknown permission string format "---rwx"} {}}
-
-close [open foo.test w]
-set ::i 4
-proc permcheck {testnum permstr expected} {
- test $testnum {SetPermissionsAttribute} {unix notRoot} {
- file attributes foo.test -permissions $permstr
- file attributes foo.test -permissions
- } $expected
-}
-permcheck unixFCmd-17.5 rwxrwxrwx 00777
-permcheck unixFCmd-17.6 r--r---w- 00442
-permcheck unixFCmd-17.7 0 00000
-permcheck unixFCmd-17.8 u+rwx,g+r 00740
-permcheck unixFCmd-17.9 u-w 00540
-permcheck unixFCmd-17.10 o+rwx 00547
-permcheck unixFCmd-17.11 --x--x--x 00111
-permcheck unixFCmd-17.12 a+rwx 00777
-file delete -force -- foo.test
-
-test unixFCmd-18.1 {Unix pwd} {nonPortable unix notRoot} {
- # This test is nonportable because SunOS generates a weird error
- # message when the current directory isn't readable.
- set cd [pwd]
- set nd $cd/tstdir
- file mkdir $nd
- cd $nd
- file attributes $nd -permissions 0000
- set r [list [catch {pwd} res] [string range $res 0 36]];
- cd $cd;
- file attributes $nd -permissions 0755
- file delete $nd
- set r
-} {1 {error getting working directory name:}}
-
-test unixFCmd-19.1 {GetReadOnlyAttribute - file not found} {unix notRoot readonlyAttr} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -readonly} msg] $msg
-} {1 {could not read "foo.test": no such file or directory}}
-test unixFCmd-19.2 {GetReadOnlyAttribute} {unix notRoot readonlyAttr} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attribute foo.test -readonly} msg] $msg \
- [file delete -force -- foo.test]
-} {0 0 {}}
-
-test unixFCmd-20.1 {SetReadOnlyAttribute} {unix notRoot readonlyAttr} {
- catch {file delete -force -- foo.test}
- close [open foo.test w]
- list [catch {file attributes foo.test -readonly 1} msg] $msg \
- [catch {file attribute foo.test -readonly} msg] $msg \
- [catch {file delete -force -- foo.test}] \
- [catch {file attributes foo.test -readonly 0} msg] $msg \
- [catch {file attribute foo.test -readonly} msg] $msg \
- [file delete -force -- foo.test]
-} {0 {} 0 1 1 0 {} 0 0 {}}
-test unixFCmd-20.2 {SetReadOnlyAttribute} {unix notRoot readonlyAttr} {
- catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -readonly 1} msg] $msg
-} {1 {could not read "foo.test": no such file or directory}}
-
-# cleanup
-cleanup
-cd $oldcwd
-::tcltest::cleanupTests
-return
-
-# Local Variables:
-# mode: tcl
-# End:
+# This file tests the tclUnixFCmd.c file.
+#
+# This file contains a collection of tests for one or more of the Tcl
+# built-in commands. Sourcing this file into Tcl runs the tests and
+# generates output for errors. No output means no errors were found.
+#
+# Copyright (c) 1996 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# RCS: @(#) $Id: unixFCmd.test,v 1.25 2008/04/10 00:21:02 dkf Exp $
+
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ package require tcltest 2
+ namespace import -force ::tcltest::*
+}
+
+testConstraint testchmod [llength [info commands testchmod]]
+
+# These tests really need to be run from a writable directory, which
+# it is assumed [temporaryDirectory] is.
+set oldcwd [pwd]
+cd [temporaryDirectory]
+
+# Several tests require need to match results against the unix username
+set user {}
+if {[testConstraint unix]} {
+ catch {set user [exec whoami]}
+ if {$user == ""} {
+ catch {regexp {^[^(]*\(([^)]*)\)} [exec id] dummy user}
+ }
+ if {$user == ""} {
+ set user "root"
+ }
+}
+
+# Find a group that exists on this system, or else skip tests that require
+# groups
+testConstraint foundGroup 0
+if {[testConstraint unix]} {
+ catch {
+ set groupList [exec groups]
+ set group [lindex $groupList 0]
+ testConstraint foundGroup 1
+ }
+}
+
+# check whether -readonly attribute is supported
+testConstraint readonlyAttr 0
+if {[testConstraint unix]} {
+ set f [makeFile "whatever" probe]
+ catch {
+ file attributes $f -readonly
+ testConstraint readonlyAttr 1
+ }
+ removeFile probe
+}
+
+proc openup {path} {
+ testchmod 777 $path
+ if {[file isdirectory $path]} {
+ catch {
+ foreach p [glob -directory $path *] {
+ openup $p
+ }
+ }
+ }
+}
+
+proc cleanup {args} {
+ foreach p ". $args" {
+ set x ""
+ catch {
+ set x [glob -directory $p tf* td*]
+ }
+ foreach file $x {
+ if {
+ [catch {file delete -force -- $file}]
+ && [testConstraint testchmod]
+ } then {
+ openup $file
+ file delete -force -- $file
+ }
+ }
+ }
+}
+
+if {[testConstraint unix] && [testConstraint notRoot]} {
+ testConstraint execMknod [expr {![catch {exec mknod tf1 p}]}]
+ cleanup
+}
+
+test unixFCmd-1.1 {TclpRenameFile: EACCES} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ file mkdir td1/td2/td3
+ file attributes td1/td2 -permissions 0000
+ file rename td1/td2/td3 td2
+} -returnCodes error -cleanup {
+ file attributes td1/td2 -permissions 0755
+ cleanup
+} -result {error renaming "td1/td2/td3": permission denied}
+test unixFCmd-1.2 {TclpRenameFile: EEXIST} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ file mkdir td1/td2
+ file mkdir td2
+ file rename td2 td1
+} -returnCodes error -cleanup {
+ cleanup
+} -result {error renaming "td2" to "td1/td2": file already exists}
+test unixFCmd-1.3 {TclpRenameFile: EINVAL} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ file mkdir td1
+ file rename td1 td1
+} -returnCodes error -cleanup {
+ cleanup
+} -result {error renaming "td1" to "td1/td1": trying to rename a volume or move a directory into itself}
+test unixFCmd-1.4 {TclpRenameFile: EISDIR} {emptyTest unix notRoot} {
+ # can't make it happen
+} {}
+test unixFCmd-1.5 {TclpRenameFile: ENOENT} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ file mkdir td1
+ file rename td2 td1
+} -returnCodes error -cleanup {
+ cleanup
+} -result {error renaming "td2": no such file or directory}
+test unixFCmd-1.6 {TclpRenameFile: ENOTDIR} {emptyTest unix notRoot} {
+ # can't make it happen
+} {}
+test unixFCmd-1.7 {TclpRenameFile: EXDEV} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ file mkdir foo/bar
+ file attr foo -perm 040555
+ file rename foo/bar /tmp
+} -returnCodes error -cleanup {
+ catch {file delete /tmp/bar}
+ catch {file attr foo -perm 040777}
+ catch {file delete -force foo}
+} -match glob -result {*: permission denied}
+test unixFCmd-1.8 {Checking EINTR Bug} {unix notRoot nonPortable} {
+ testalarm
+ after 2000
+ list [testgotsig] [testgotsig]
+} {1 0}
+test unixFCmd-1.9 {Checking EINTR Bug} -constraints {unix notRoot nonPortable} -setup {
+ cleanup
+ set f [open tfalarm w]
+ puts $f {
+ after 2000
+ puts "hello world"
+ exit 0
+ }
+ close $f
+} -body {
+ testalarm
+ set pipe [open "|[info nameofexecutable] tfalarm" r+]
+ set line [read $pipe 1]
+ catch {close $pipe}
+ list $line [testgotsig]
+} -cleanup {
+ cleanup
+} -result {h 1}
+
+test unixFCmd-2.1 {TclpCopyFile: target exists: lstat(dst) == 0} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ close [open tf1 a]
+ close [open tf2 a]
+ file copy -force tf1 tf2
+} -cleanup {
+ cleanup
+} -result {}
+test unixFCmd-2.2.1 {TclpCopyFile: src is symlink} -setup {
+ cleanup
+} -constraints {unix notRoot dontCopyLinks} -body {
+ # copying links should end up with real files
+ close [open tf1 a]
+ file link -symbolic tf2 tf1
+ file copy tf2 tf3
+ file type tf3
+} -cleanup {
+ cleanup
+} -result file
+test unixFCmd-2.2.2 {TclpCopyFile: src is symlink} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ # copying links should end up with the links copied
+ close [open tf1 a]
+ file link -symbolic tf2 tf1
+ file copy tf2 tf3
+ file type tf3
+} -cleanup {
+ cleanup
+} -result link
+test unixFCmd-2.3 {TclpCopyFile: src is block} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ set null "/dev/null"
+ while {[file type $null] != "characterSpecial"} {
+ set null [file join [file dirname $null] [file readlink $null]]
+ }
+ # file copy $null tf1
+} -result {}
+test unixFCmd-2.4 {TclpCopyFile: src is fifo} -setup {
+ cleanup
+} -constraints {unix notRoot execMknod} -body {
+ exec mknod tf1 p
+ file copy tf1 tf2
+ list [file type tf1] [file type tf2]
+} -cleanup {
+ cleanup
+} -result {fifo fifo}
+test unixFCmd-2.5 {TclpCopyFile: copy attributes} -setup {
+ cleanup
+} -constraints {unix notRoot} -body {
+ close [open tf1 a]
+ file attributes tf1 -permissions 0472
+ file copy tf1 tf2
+ file attributes tf2 -permissions
+} -cleanup {
+ cleanup
+} -result 00472 ;# i.e. perms field of [exec ls -l tf2] is -r--rwx-w-
+
+test unixFCmd-3.1 {CopyFile not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-4.1 {TclpDeleteFile not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-5.1 {TclpCreateDirectory not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-6.1 {TclpCopyDirectory not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-7.1 {TclpRemoveDirectory not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-8.1 {TraverseUnixTree not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-9.1 {TraversalCopy not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-10.1 {TraversalDelete not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-11.1 {CopyFileAttrs not done} {emptyTest unix notRoot} {
+} {}
+
+test unixFCmd-12.1 {GetGroupAttribute - file not found} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -returnCodes error -body {
+ file attributes foo.test -group
+} -result {could not read "foo.test": no such file or directory}
+test unixFCmd-12.2 {GetGroupAttribute - file found} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ close [open foo.test w]
+ file attributes foo.test -group
+} -cleanup {
+ file delete -force -- foo.test
+} -match glob -result *
+
+test unixFCmd-13.1 {GetOwnerAttribute - file not found} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -returnCodes error -body {
+ list [catch {file attributes foo.test -group} msg] $msg
+} -result {could not read "foo.test": no such file or directory}
+test unixFCmd-13.2 {GetOwnerAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ close [open foo.test w]
+ file attributes foo.test -owner
+} -cleanup {
+ file delete -force -- foo.test
+} -result $user
+
+test unixFCmd-14.1 {GetPermissionsAttribute - file not found} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -returnCodes error -body {
+ file attributes foo.test -permissions
+} -result {could not read "foo.test": no such file or directory}
+test unixFCmd-14.2 {GetPermissionsAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ close [open foo.test w]
+ file attribute foo.test -permissions
+} -cleanup {
+ file delete -force -- foo.test
+} -match glob -result *
+
+#groups hard to test
+test unixFCmd-15.1 {SetGroupAttribute - invalid group} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ file attributes foo.test -group foozzz
+} -returnCodes error -cleanup {
+ file delete -force -- foo.test
+} -result {could not set group for file "foo.test": group "foozzz" does not exist}
+test unixFCmd-15.2 {SetGroupAttribute - invalid file} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot foundGroup} -returnCodes error -body {
+ file attributes foo.test -group $group
+} -result {could not set group for file "foo.test": no such file or directory}
+
+#changing owners hard to do
+test unixFCmd-16.1 {SetOwnerAttribute - current owner} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ close [open foo.test w]
+ list [file attributes foo.test -owner $user] \
+ [file attributes foo.test -owner]
+} -cleanup {
+ file delete -force -- foo.test
+} -result [list {} $user]
+test unixFCmd-16.2 {SetOwnerAttribute - invalid file} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -returnCodes error -body {
+ file attributes foo.test -owner $user
+} -result {could not set owner for file "foo.test": no such file or directory}
+test unixFCmd-16.3 {SetOwnerAttribute - invalid owner} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -returnCodes error -body {
+ file attributes foo.test -owner foozzz
+} -result {could not set owner for file "foo.test": user "foozzz" does not exist}
+
+test unixFCmd-17.1 {SetPermissionsAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ close [open foo.test w]
+ list [file attributes foo.test -permissions 0000] \
+ [file attributes foo.test -permissions]
+} -cleanup {
+ file delete -force -- foo.test
+} -result {{} 00000}
+test unixFCmd-17.2 {SetPermissionsAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -returnCodes error -body {
+ file attributes foo.test -permissions 0000
+} -result {could not set permissions for file "foo.test": no such file or directory}
+test unixFCmd-17.3 {SetPermissionsAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ close [open foo.test w]
+ file attributes foo.test -permissions foo
+} -cleanup {
+ file delete -force -- foo.test
+} -returnCodes error -result {unknown permission string format "foo"}
+test unixFCmd-17.4 {SetPermissionsAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot} -body {
+ close [open foo.test w]
+ file attributes foo.test -permissions ---rwx
+} -cleanup {
+ file delete -force -- foo.test
+} -returnCodes error -result {unknown permission string format "---rwx"}
+
+close [open foo.test w]
+set ::i 4
+proc permcheck {testnum permstr expected} {
+ test $testnum {SetPermissionsAttribute} {unix notRoot} {
+ file attributes foo.test -permissions $permstr
+ file attributes foo.test -permissions
+ } $expected
+}
+permcheck unixFCmd-17.5 rwxrwxrwx 00777
+permcheck unixFCmd-17.6 r--r---w- 00442
+permcheck unixFCmd-17.7 0 00000
+permcheck unixFCmd-17.8 u+rwx,g+r 00740
+permcheck unixFCmd-17.9 u-w 00540
+permcheck unixFCmd-17.10 o+rwx 00547
+permcheck unixFCmd-17.11 --x--x--x 00111
+permcheck unixFCmd-17.12 a+rwx 00777
+file delete -force -- foo.test
+
+test unixFCmd-18.1 {Unix pwd} -constraints {unix notRoot nonPortable} -setup {
+ set cd [pwd]
+} -body {
+ # This test is nonportable because SunOS generates a weird error
+ # message when the current directory isn't readable.
+ set nd $cd/tstdir
+ file mkdir $nd
+ cd $nd
+ file attributes $nd -permissions 0000
+ pwd
+} -returnCodes error -cleanup {
+ cd $cd
+ file attributes $nd -permissions 0755
+ file delete $nd
+} -match glob -result {error getting working directory name:*}
+
+test unixFCmd-19.1 {GetReadOnlyAttribute - file not found} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot readonlyAttr} -returnCodes error -body {
+ file attributes foo.test -readonly
+} -result {could not read "foo.test": no such file or directory}
+test unixFCmd-19.2 {GetReadOnlyAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot readonlyAttr} -body {
+ close [open foo.test w]
+ file attribute foo.test -readonly
+} -cleanup {
+ file delete -force -- foo.test
+} -result 0
+
+test unixFCmd-20.1 {SetReadOnlyAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot readonlyAttr} -body {
+ close [open foo.test w]
+ list [catch {file attributes foo.test -readonly 1} msg] $msg \
+ [catch {file attribute foo.test -readonly} msg] $msg \
+ [catch {file delete -force -- foo.test}] \
+ [catch {file attributes foo.test -readonly 0} msg] $msg \
+ [catch {file attribute foo.test -readonly} msg] $msg
+} -cleanup {
+ file delete -force -- foo.test
+} -result {0 {} 0 1 1 0 {} 0 0}
+test unixFCmd-20.2 {SetReadOnlyAttribute} -setup {
+ catch {file delete -force -- foo.test}
+} -constraints {unix notRoot readonlyAttr} -returnCodes error -body {
+ file attributes foo.test -readonly 1
+} -result {could not read "foo.test": no such file or directory}
+
+# cleanup
+cleanup
+cd $oldcwd
+::tcltest::cleanupTests
+return
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/tests/winFCmd.test b/tests/winFCmd.test
index 24fbf8e..f434516 100644
--- a/tests/winFCmd.test
+++ b/tests/winFCmd.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: winFCmd.test,v 1.42 2007/02/20 15:36:47 patthoyts Exp $
+# RCS: @(#) $Id: winFCmd.test,v 1.43 2008/04/10 00:21:02 dkf Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -67,17 +67,13 @@ if {[testConstraint winOnly]} {
# find a CD-ROM so we can test read-only filesystems.
proc findfile {dir} {
- foreach p [glob -directory $dir *] {
- if {[file type $p] == "file"} {
- return $p
- }
+ foreach p [glob -nocomplain -type f -directory $dir *] {
+ return $p
}
- foreach p [glob -directory $dir *] {
- if {[file type $p] == "directory"} {
- set f [findfile $p]
- if {$f != ""} {
- return $f
- }
+ foreach p [glob -nocomplain -type d -directory $dir *] {
+ set f [findfile $p]
+ if {$f ne ""} {
+ return $f
}
}
return ""
@@ -85,7 +81,7 @@ proc findfile {dir} {
if {[testConstraint testvolumetype]} {
foreach p {d e f g h i j k l m n o p q r s t u v w x y z} {
- if {![catch {testvolumetype ${p}:} result] && $result eq "CDFS"} {
+ if {![catch {testvolumetype ${p}:} result] && $result in {CDFS UDF}} {
set cdrom ${p}:
set cdfile [findfile $cdrom]
testConstraint cdrom 1
@@ -97,7 +93,7 @@ if {[testConstraint testvolumetype]} {
# NB: filename is chosen to be short but unlikely to clash with other apps
if {[file exists c:/] && [file exists d:/]} {
catch {file delete d:/TclTmpF.1}
- if {[catch {close [open d:/TclTmpF.1 w]}] == 0} {
+ if {[catch {createfile d:/TclTmpF.1 {}}] == 0} {
file delete d:/TclTmpF.1
testConstraint exdev 1
}
@@ -126,622 +122,793 @@ append longname $longname
# it can be difficult to actually forward "insane" arguments to the
# low-level posix emulation layer.
-test winFCmd-1.1 {TclpRenameFile: errno: EACCES} {win cdrom testfile} {
- list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
-} {1 EACCES}
-test winFCmd-1.2 {TclpRenameFile: errno: EEXIST} {win testfile} {
+test winFCmd-1.1 {TclpRenameFile: errno: EACCES} -body {
+ testfile mv $cdfile $cdrom/dummy~~.fil
+} -constraints {win cdrom testfile} -returnCodes error -result EACCES
+test winFCmd-1.2 {TclpRenameFile: errno: EEXIST} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1/td2/td3
file mkdir td2
- list [catch {testfile mv td2 td1/td2} msg] $msg
-} {1 EEXIST}
-test winFCmd-1.3 {TclpRenameFile: errno: EINVAL} {win testfile} {
+ testfile mv td2 td1/td2
+} -returnCodes error -result EEXIST
+test winFCmd-1.3 {TclpRenameFile: errno: EINVAL} -setup {
cleanup
- list [catch {testfile mv / td1} msg] $msg
-} {1 EINVAL}
-test winFCmd-1.4 {TclpRenameFile: errno: EINVAL} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile mv / td1
+} -returnCodes error -result EINVAL
+test winFCmd-1.4 {TclpRenameFile: errno: EINVAL} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile mv td1 td1/td2} msg] $msg
-} {1 EINVAL}
-test winFCmd-1.5 {TclpRenameFile: errno: EISDIR} {win testfile} {
+ testfile mv td1 td1/td2
+} -returnCodes error -result EINVAL
+test winFCmd-1.5 {TclpRenameFile: errno: EISDIR} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile tf1
- list [catch {testfile mv tf1 td1} msg] $msg
-} {1 EISDIR}
-test winFCmd-1.6 {TclpRenameFile: errno: ENOENT} {win testfile} {
+ testfile mv tf1 td1
+} -returnCodes error -result EISDIR
+test winFCmd-1.6 {TclpRenameFile: errno: ENOENT} -setup {
cleanup
- list [catch {testfile mv tf1 tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.7 {TclpRenameFile: errno: ENOENT} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile mv tf1 tf2
+} -returnCodes error -result ENOENT
+test winFCmd-1.7 {TclpRenameFile: errno: ENOENT} -setup {
cleanup
- list [catch {testfile mv "" tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.8 {TclpRenameFile: errno: ENOENT} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile mv "" tf2
+} -returnCodes error -result ENOENT
+test winFCmd-1.8 {TclpRenameFile: errno: ENOENT} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
- list [catch {testfile mv tf1 ""} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.9 {TclpRenameFile: errno: ENOTDIR} {win testfile} {
+ testfile mv tf1 ""
+} -returnCodes error -result ENOENT
+test winFCmd-1.9 {TclpRenameFile: errno: ENOTDIR} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile tf1
- list [catch {testfile mv td1 tf1} msg] $msg
-} {1 ENOTDIR}
-test winFCmd-1.10 {TclpRenameFile: errno: EXDEV} {win exdev testfile} {
+ testfile mv td1 tf1
+} -returnCodes error -result ENOTDIR
+test winFCmd-1.10 {TclpRenameFile: errno: EXDEV} -setup {
file delete -force d:/tf1
+} -constraints {win exdev testfile} -body {
file mkdir c:/tf1
- set msg [list [catch {testfile mv c:/tf1 d:/tf1} msg] $msg]
+ testfile mv c:/tf1 d:/tf1
+} -cleanup {
file delete -force c:/tf1
- set msg
-} {1 EXDEV}
-test winFCmd-1.11 {TclpRenameFile: errno: EACCES} {win testfile} {
+} -returnCodes error -result EXDEV
+test winFCmd-1.11 {TclpRenameFile: errno: EACCES} -setup {
cleanup
+} -constraints {win testfile} -body {
set fd [open tf1 w]
- set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
- close $fd
- set msg
-} {1 EACCES}
-test winFCmd-1.12 {TclpRenameFile: errno: EACCES} {win testfile} {
+ testfile mv tf1 tf2
+} -cleanup {
+ catch {close $fd}
+} -returnCodes error -result EACCES
+test winFCmd-1.12 {TclpRenameFile: errno: EACCES} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
set fd [open tf2 w]
- set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
- close $fd
- set msg
-} {1 EACCES}
-test winFCmd-1.13 {TclpRenameFile: errno: EACCES} {win win2000orXP testfile} {
- cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 EINVAL}
-test winFCmd-1.13.1 {TclpRenameFile: errno: EACCES} {win nt winOlderThan2000 testfile} {
- cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-1.13.2 {TclpRenameFile: errno: ENOENT} {win 95 testfile} {
- cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.14 {TclpRenameFile: errno: EACCES} {win 95 testfile} {
- cleanup
+ testfile mv tf1 tf2
+} -cleanup {
+ catch {close $fd}
+} -returnCodes error -result EACCES
+test winFCmd-1.13 {TclpRenameFile: errno: EACCES} -setup {
+ cleanup
+} -constraints {win win2000orXP testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result EINVAL
+test winFCmd-1.13.1 {TclpRenameFile: errno: EACCES} -setup {
+ cleanup
+} -constraints {win nt winOlderThan2000 testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result EACCES
+test winFCmd-1.13.2 {TclpRenameFile: errno: ENOENT} -setup {
+ cleanup
+} -constraints {win 95 testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result ENOENT
+test winFCmd-1.14 {TclpRenameFile: errno: EACCES} -setup {
+ cleanup
+} -constraints {win 95 testfile} -body {
createfile tf1
- list [catch {testfile mv tf1 nul} msg] $msg
-} {1 EACCES}
-test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} {win nt testfile} {
+ testfile mv tf1 nul
+} -returnCodes error -result EACCES
+test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} -setup {
cleanup
+} -constraints {win nt testfile} -body {
createfile tf1
- list [catch {testfile mv tf1 nul} msg] $msg
-} {1 EEXIST}
-test winFCmd-1.16 {TclpRenameFile: MoveFile() != FALSE} {win testfile} {
+ testfile mv tf1 nul
+} -returnCodes error -result EEXIST
+test winFCmd-1.16 {TclpRenameFile: MoveFile() != FALSE} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1 tf1
testfile mv tf1 tf2
list [file exists tf1] [contents tf2]
-} {0 tf1}
-test winFCmd-1.17 {TclpRenameFile: MoveFile() == FALSE} {win testfile} {
- cleanup
- list [catch {testfile mv tf1 tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} {win testfile} {
- cleanup
- list [catch {testfile mv tf1 tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.19 {TclpRenameFile: errno == EACCES} {win win2000orXP testfile} {
+} -result {0 tf1}
+test winFCmd-1.17 {TclpRenameFile: MoveFile() == FALSE} -setup {
cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 EINVAL}
-test winFCmd-1.19.1 {TclpRenameFile: errno == EACCES} {win nt winOlderThan2000 testfile} {
- cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-1.19.2 {TclpRenameFile: errno == ENOENT} {win 95 testfile} {
+} -constraints {win testfile} -body {
+ testfile mv tf1 tf2
+} -returnCodes error -result ENOENT
+test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} -setup {
cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.20 {TclpRenameFile: src is dir} {win nt testfile} {
- # under 95, this would actually succeed and move the current dir out from
+} -constraints {win testfile} -body {
+ testfile mv tf1 tf2
+} -returnCodes error -result ENOENT
+test winFCmd-1.19 {TclpRenameFile: errno == EACCES} -setup {
+ cleanup
+} -constraints {win win2000orXP testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result EINVAL
+test winFCmd-1.19.1 {TclpRenameFile: errno == EACCES} -setup {
+ cleanup
+} -constraints {win nt winOlderThan2000 testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result EACCES
+test winFCmd-1.19.2 {TclpRenameFile: errno == ENOENT} -setup {
+ cleanup
+} -constraints {win 95 testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result ENOENT
+test winFCmd-1.20 {TclpRenameFile: src is dir} -setup {
+ cleanup
+} -constraints {win nt testfile} -body {
+ # under 95, this would actually succeed and move the current dir out from
# under the current process!
- cleanup
file delete /tf1
- list [catch {testfile mv [pwd] /tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-1.21 {TclpRenameFile: long src} {win testfile} {
+ testfile mv [pwd] /tf1
+} -returnCodes error -result EACCES
+test winFCmd-1.21 {TclpRenameFile: long src} -setup {
cleanup
- list [catch {testfile mv $longname tf1} msg] $msg
-} {1 ENAMETOOLONG}
-test winFCmd-1.22 {TclpRenameFile: long dst} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile mv $longname tf1
+} -returnCodes error -result ENAMETOOLONG
+test winFCmd-1.22 {TclpRenameFile: long dst} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
- list [catch {testfile mv tf1 $longname} msg] $msg
-} {1 ENAMETOOLONG}
-test winFCmd-1.23 {TclpRenameFile: move dir into self} {win testfile} {
+ testfile mv tf1 $longname
+} -returnCodes error -result ENAMETOOLONG
+test winFCmd-1.23 {TclpRenameFile: move dir into self} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile mv [pwd]/td1 td1/td2} msg] $msg
-} {1 EINVAL}
-test winFCmd-1.24 {TclpRenameFile: move a root dir} {win testfile} {
+ testfile mv [pwd]/td1 td1/td2
+} -returnCodes error -result EINVAL
+test winFCmd-1.24 {TclpRenameFile: move a root dir} -setup {
cleanup
- list [catch {testfile mv / c:/} msg] $msg
-} {1 EINVAL}
-test winFCmd-1.25 {TclpRenameFile: cross file systems} {win cdrom testfile} {
+} -constraints {win testfile} -body {
+ testfile mv / c:/
+} -returnCodes error -result EINVAL
+test winFCmd-1.25 {TclpRenameFile: cross file systems} -setup {
cleanup
+} -constraints {win cdrom testfile} -body {
file mkdir td1
- list [catch {testfile mv td1 $cdrom/td1} msg] $msg
-} {1 EXDEV}
-test winFCmd-1.26 {TclpRenameFile: readonly fs} {win cdrom testfile} {
+ testfile mv td1 $cdrom/td1
+} -returnCodes error -result EXDEV
+test winFCmd-1.26 {TclpRenameFile: readonly fs} -setup {
cleanup
- list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
-} {1 EACCES}
-test winFCmd-1.27 {TclpRenameFile: open file} {win testfile} {
+} -constraints {win cdrom testfile} -body {
+ testfile mv $cdfile $cdrom/dummy~~.fil
+} -returnCodes error -result EACCES
+test winFCmd-1.27 {TclpRenameFile: open file} -setup {
cleanup
+} -constraints {win testfile} -body {
set fd [open tf1 w]
- set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
- close $fd
- set msg
-} {1 EACCES}
-test winFCmd-1.28 {TclpRenameFile: errno == EEXIST} {win testfile} {
+ testfile mv tf1 tf2
+} -cleanup {
+ catch {close $fd}
+} -returnCodes error -result EACCES
+test winFCmd-1.28 {TclpRenameFile: errno == EEXIST} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
createfile tf2
testfile mv tf1 tf2
list [file exists tf1] [file exists tf2]
-} {0 1}
-test winFCmd-1.29 {TclpRenameFile: src is dir} {win testfile} {
+} -result {0 1}
+test winFCmd-1.29 {TclpRenameFile: src is dir} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile tf1
- list [catch {testfile mv td1 tf1} msg] $msg
-} {1 ENOTDIR}
-test winFCmd-1.30 {TclpRenameFile: dst is dir} {win testfile} {
+ testfile mv td1 tf1
+} -returnCodes error -result ENOTDIR
+test winFCmd-1.30 {TclpRenameFile: dst is dir} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
file mkdir td2/td2
- list [catch {testfile mv td1 td2} msg] $msg
-} {1 EEXIST}
-test winFCmd-1.31 {TclpRenameFile: TclpRemoveDirectory fails} {win testfile} {
+ testfile mv td1 td2
+} -returnCodes error -result EEXIST
+test winFCmd-1.31 {TclpRenameFile: TclpRemoveDirectory fails} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
file mkdir td2/td2
- list [catch {testfile mv td1 td2} msg] $msg
-} {1 EEXIST}
-test winFCmd-1.32 {TclpRenameFile: TclpRemoveDirectory succeeds} {win testfile} {
+ testfile mv td1 td2
+} -returnCodes error -result EEXIST
+test winFCmd-1.32 {TclpRenameFile: TclpRemoveDirectory succeeds} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1/td2
file mkdir td2
testfile mv td1 td2
list [file exists td1] [file exists td2] [file exists td2/td2]
-} {0 1 1}
+} -result {0 1 1}
test winFCmd-1.33 {TclpRenameFile: After removing dst dir, MoveFile fails} \
- {win exdev testfile testchmod} {
+ -constraints {win exdev testfile testchmod} -body {
file mkdir d:/td1
testchmod 000 d:/td1
file mkdir c:/tf1
- set msg [list [catch {testfile mv c:/tf1 d:/td1} msg] $msg]
- set msg "$msg [file writable d:/td1]"
+ catch {testfile mv c:/tf1 d:/td1} msg
+ list $msg [file writable d:/td1]
+} -cleanup {
file delete d:/td1
file delete -force c:/tf1
- set msg
-} {1 EXDEV 0}
-test winFCmd-1.34 {TclpRenameFile: src is dir, dst is not} {win testfile} {
+} -result {EXDEV 0}
+test winFCmd-1.34 {TclpRenameFile: src is dir, dst is not} -setup {
+ cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile tf1
- list [catch {testfile mv td1 tf1} msg] $msg
-} {1 ENOTDIR}
-test winFCmd-1.35 {TclpRenameFile: src is not dir, dst is} {win testfile} {
+ testfile mv td1 tf1
+} -cleanup {
+ cleanup
+} -returnCodes error -result ENOTDIR
+test winFCmd-1.35 {TclpRenameFile: src is not dir, dst is} -setup {
+ cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile tf1
- list [catch {testfile mv tf1 td1} msg] $msg
-} {1 EISDIR}
-test winFCmd-1.36 {TclpRenameFile: src and dst not dir} {win testfile} {
+ testfile mv tf1 td1
+} -cleanup {
+ cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-1.36 {TclpRenameFile: src and dst not dir} -setup {
+ cleanup
+} -constraints {win testfile} -body {
createfile tf1 tf1
createfile tf2 tf2
testfile mv tf1 tf2
contents tf2
-} {tf1}
+} -cleanup {
+ cleanup
+} -result {tf1}
test winFCmd-1.37 {TclpRenameFile: need to restore temp file} {win emptyTest} {
- # Can't figure out how to cause this.
+ # Can't figure out how to cause this.
# Need a file that can't be copied.
} {}
-test winFCmd-2.1 {TclpCopyFile: errno: EACCES} {win cdrom testfile} {
+test winFCmd-2.1 {TclpCopyFile: errno: EACCES} -setup {
cleanup
- list [catch {testfile cp $cdfile $cdrom/dummy~~.fil} msg] $msg
-} {1 EACCES}
-test winFCmd-2.2 {TclpCopyFile: errno: EISDIR} {win testfile} {
+} -constraints {win cdrom testfile} -body {
+ testfile cp $cdfile $cdrom/dummy~~.fil
+} -returnCodes error -result EACCES
+test winFCmd-2.2 {TclpCopyFile: errno: EISDIR} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile cp td1 tf1} msg] $msg
-} {1 EISDIR}
-test winFCmd-2.3 {TclpCopyFile: errno: EISDIR} {win testfile} {
+ testfile cp td1 tf1
+} -cleanup {
+ cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-2.3 {TclpCopyFile: errno: EISDIR} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
file mkdir td1
- list [catch {testfile cp tf1 td1} msg] $msg
-} {1 EISDIR}
-test winFCmd-2.4 {TclpCopyFile: errno: ENOENT} {win testfile} {
+ testfile cp tf1 td1
+} -cleanup {
cleanup
- list [catch {testfile cp tf1 tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} {win testfile} {
+} -returnCodes error -result EISDIR
+test winFCmd-2.4 {TclpCopyFile: errno: ENOENT} -setup {
cleanup
- list [catch {testfile cp "" tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-2.6 {TclpCopyFile: errno: ENOENT} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile cp tf1 tf2
+} -returnCodes error -result ENOENT
+test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} -setup {
cleanup
+} -constraints {win testfile} -body {
+ testfile cp "" tf2
+} -returnCodes error -result ENOENT
+test winFCmd-2.6 {TclpCopyFile: errno: ENOENT} -setup {
+ cleanup
+} -constraints {win testfile} -body {
createfile tf1
- list [catch {testfile cp tf1 ""} msg] $msg
-} {1 ENOENT}
-test winFCmd-2.7 {TclpCopyFile: errno: EACCES} {win 95 testfile} {
+ testfile cp tf1 ""
+} -cleanup {
cleanup
+} -returnCodes error -result ENOENT
+test winFCmd-2.7 {TclpCopyFile: errno: EACCES} -setup {
+ cleanup
+} -constraints {win 95 testfile} -body {
createfile tf1
set fd [open tf2 w]
- set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
+ testfile cp tf1 tf2
+} -cleanup {
close $fd
- set msg
-} {1 EACCES}
-test winFCmd-2.8 {TclpCopyFile: errno: EACCES} {win win2000orXP testfile} {
cleanup
- list [catch {testfile cp nul tf1} msg] $msg
-} {1 EINVAL}
-test winFCmd-2.8.1 {TclpCopyFile: errno: EACCES} {win nt winOlderThan2000 testfile} {
+} -returnCodes error -result EACCES
+test winFCmd-2.8 {TclpCopyFile: errno: EACCES} -setup {
+ cleanup
+} -constraints {win win2000orXP testfile} -body {
+ testfile cp nul tf1
+} -returnCodes error -result EINVAL
+test winFCmd-2.8.1 {TclpCopyFile: errno: EACCES} -setup {
cleanup
- list [catch {testfile cp nul tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-2.9 {TclpCopyFile: errno: ENOENT} {win 95 testfile} {
+} -constraints {win nt winOlderThan2000 testfile} -body {
+ testfile cp nul tf1
+} -returnCodes error -result EACCES
+test winFCmd-2.9 {TclpCopyFile: errno: ENOENT} -setup {
cleanup
- list [catch {testfile cp nul tf1} msg] $msg
-} {1 ENOENT}
-test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} {win testfile} {
+} -constraints {win 95 testfile} -body {
+ testfile cp nul tf1
+} -returnCodes error -result ENOENT
+test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1 tf1
testfile cp tf1 tf2
list [contents tf1] [contents tf2]
-} {tf1 tf1}
-test winFCmd-2.11 {TclpCopyFile: CopyFile succeeds} {win testfile} {
+} -cleanup {
+ cleanup
+} -result {tf1 tf1}
+test winFCmd-2.11 {TclpCopyFile: CopyFile succeeds} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1 tf1
createfile tf2 tf2
testfile cp tf1 tf2
list [contents tf1] [contents tf2]
-} {tf1 tf1}
-test winFCmd-2.12 {TclpCopyFile: CopyFile succeeds} {win testfile} {
+} -cleanup {
+ cleanup
+} -result {tf1 tf1}
+test winFCmd-2.12 {TclpCopyFile: CopyFile succeeds} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1 tf1
testchmod 000 tf1
testfile cp tf1 tf2
list [contents tf2] [file writable tf2]
-} {tf1 0}
-test winFCmd-2.13 {TclpCopyFile: CopyFile fails} {win testfile} {
+} -cleanup {
+ cleanup
+} -result {tf1 0}
+test winFCmd-2.13 {TclpCopyFile: CopyFile fails} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
file mkdir td1
- list [catch {testfile cp tf1 td1} msg] $msg
-} {1 EISDIR}
-test winFCmd-2.14 {TclpCopyFile: errno == EACCES} {win testfile} {
+ testfile cp tf1 td1
+} -cleanup {
cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-2.14 {TclpCopyFile: errno == EACCES} -setup {
+ cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile cp td1 tf1} msg] $msg
-} {1 EISDIR}
-test winFCmd-2.15 {TclpCopyFile: src is directory} {win testfile} {
+ testfile cp td1 tf1
+} -cleanup {
cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-2.15 {TclpCopyFile: src is directory} -setup {
+ cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile cp td1 tf1} msg] $msg
-} {1 EISDIR}
-test winFCmd-2.16 {TclpCopyFile: dst is directory} {win testfile} {
+ testfile cp td1 tf1
+} -cleanup {
cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-2.16 {TclpCopyFile: dst is directory} -setup {
+ cleanup
+} -constraints {win testfile} -body {
createfile tf1
file mkdir td1
- list [catch {testfile cp tf1 td1} msg] $msg
-} {1 EISDIR}
-test winFCmd-2.17 {TclpCopyFile: dst is readonly} {win testfile testchmod} {
+ testfile cp tf1 td1
+} -cleanup {
+ cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-2.17 {TclpCopyFile: dst is readonly} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
createfile tf1 tf1
createfile tf2 tf2
testchmod 000 tf2
testfile cp tf1 tf2
list [file writable tf2] [contents tf2]
-} {1 tf1}
-test winFCmd-2.18 {TclpCopyFile: still can't copy onto dst} {win 95 testfile testchmod} {
+} -cleanup {
+ cleanup
+} -result {1 tf1}
+test winFCmd-2.18 {TclpCopyFile: still can't copy onto dst} -setup {
cleanup
+} -constraints {win 95 testfile testchmod} -body {
createfile tf1
createfile tf2
testchmod 000 tf2
set fd [open tf2]
set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
close $fd
- set msg "$msg [file writable tf2]"
-} {1 EACCES 0}
+ lappend msg [file writable tf2]
+} -result {1 EACCES 0}
-test winFCmd-3.1 {TclpDeleteFile: errno: EACCES} {win cdrom testfile} {
- list [catch {testfile rm $cdfile $cdrom/dummy~~.fil} msg] $msg
-} {1 EACCES}
-test winFCmd-3.2 {TclpDeleteFile: errno: EISDIR} {win testfile} {
+test winFCmd-3.1 {TclpDeleteFile: errno: EACCES} -body {
+ testfile rm $cdfile $cdrom/dummy~~.fil
+} -constraints {win cdrom testfile} -returnCodes error -result EACCES
+test winFCmd-3.2 {TclpDeleteFile: errno: EISDIR} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile rm td1} msg] $msg
-} {1 EISDIR}
-test winFCmd-3.3 {TclpDeleteFile: errno: ENOENT} {win testfile} {
+ testfile rm td1
+} -cleanup {
+ cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-3.3 {TclpDeleteFile: errno: ENOENT} -setup {
cleanup
- list [catch {testfile rm tf1} msg] $msg
-} {1 ENOENT}
-test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile rm tf1
+} -returnCodes error -result ENOENT
+test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} -setup {
cleanup
- list [catch {testfile rm ""} msg] $msg
-} {1 ENOENT}
-test winFCmd-3.5 {TclpDeleteFile: errno: EACCES} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile rm ""
+} -returnCodes error -result ENOENT
+test winFCmd-3.5 {TclpDeleteFile: errno: EACCES} -setup {
cleanup
+} -constraints {win testfile} -body {
set fd [open tf1 w]
- set msg [list [catch {testfile rm tf1} msg] $msg]
+ testfile rm tf1
+} -cleanup {
close $fd
- set msg
-} {1 EACCES}
-test winFCmd-3.6 {TclpDeleteFile: errno: EACCES} {win testfile} {
cleanup
- list [catch {testfile rm nul} msg] $msg
-} {1 EACCES}
-test winFCmd-3.7 {TclpDeleteFile: DeleteFile succeeds} {win testfile} {
+} -returnCodes error -result EACCES
+test winFCmd-3.6 {TclpDeleteFile: errno: EACCES} -setup {
+ cleanup
+} -constraints {win testfile} -body {
+ testfile rm nul
+} -returnCodes error -result EACCES
+test winFCmd-3.7 {TclpDeleteFile: DeleteFile succeeds} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
testfile rm tf1
file exists tf1
-} {0}
-test winFCmd-3.8 {TclpDeleteFile: DeleteFile fails} {win testfile} {
+} -result {0}
+test winFCmd-3.8 {TclpDeleteFile: DeleteFile fails} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile rm td1} msg] $msg
-} {1 EISDIR}
-test winFCmd-3.9 {TclpDeleteFile: errno == EACCES} {win testfile} {
+ testfile rm td1
+} -cleanup {
+ cleanup
+} -returnCodes error -result EISDIR
+test winFCmd-3.9 {TclpDeleteFile: errno == EACCES} -setup {
cleanup
+} -constraints {win testfile} -body {
set fd [open tf1 w]
- set msg [list [catch {testfile rm tf1} msg] $msg]
+ testfile rm tf1
+} -cleanup {
close $fd
- set msg
-} {1 EACCES}
-test winFCmd-3.10 {TclpDeleteFile: path is readonly} {win testfile testchmod} {
+} -returnCodes error -result EACCES
+test winFCmd-3.10 {TclpDeleteFile: path is readonly} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
createfile tf1
testchmod 000 tf1
testfile rm tf1
file exists tf1
-} {0}
-test winFCmd-3.11 {TclpDeleteFile: still can't remove path} {win testfile testchmod} {
+} -result {0}
+test winFCmd-3.11 {TclpDeleteFile: still can't remove path} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
set fd [open tf1 w]
testchmod 000 tf1
- set msg [list [catch {testfile rm tf1} msg] $msg]
+ testfile rm tf1
+} -cleanup {
close $fd
- set msg
-} {1 EACCES}
+ cleanup
+} -returnCodes error -result EACCES
-test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} {win nt cdrom testfile} {
- list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
-} {1 EACCES}
-test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} {win 95 cdrom testfile} {
- list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
-} {1 ENOSPC}
-test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} {win testfile} {
+test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} -body {
+ testfile mkdir $cdrom/dummy~~.dir
+} -constraints {win nt cdrom testfile} -returnCodes error -result EACCES
+test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} -body {
+ testfile mkdir $cdrom/dummy~~.dir
+} -constraints {win 95 cdrom testfile} -returnCodes error -result ENOSPC
+test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile mkdir td1} msg] $msg
-} {1 EEXIST}
-test winFCmd-4.4 {TclpCreateDirectory: errno: ENOENT} {win testfile} {
+ testfile mkdir td1
+} -cleanup {
cleanup
- list [catch {testfile mkdir td1/td2} msg] $msg
-} {1 ENOENT}
-test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} {win testfile} {
+} -returnCodes error -result EEXIST
+test winFCmd-4.4 {TclpCreateDirectory: errno: ENOENT} -setup {
cleanup
+} -constraints {win testfile} -body {
+ testfile mkdir td1/td2
+} -returnCodes error -result ENOENT
+test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} -setup {
+ cleanup
+} -constraints {win testfile} -body {
testfile mkdir td1
file type td1
-} {directory}
+} -cleanup cleanup -result directory
-test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} {win testfile} {
+test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
testfile cpdir td1 td2
list [file type td1] [file type td2]
-} {directory directory}
+} -cleanup {
+ cleanup
+} -result {directory directory}
-test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} {win testfile testchmod} {
+test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
file mkdir td1
testchmod 000 td1
testfile rmdir td1
file exists td1
-} {0}
-test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} {win testfile} {
+} -result {0}
+# This next test has a very hokey way of matching...
+test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1/td2
list [catch {testfile rmdir td1} msg] [file tail $msg]
-} {1 {td1 EEXIST}}
+} -result {1 {td1 EEXIST}}
test winFCmd-6.3 {TclpRemoveDirectory: errno: EACCES} {win emptyTest} {
# can't test this w/o removing everything on your hard disk first!
# testfile rmdir /
} {}
-test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} {win testfile} {
+# This next test has a very hokey way of matching...
+test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} -setup {
cleanup
+} -constraints {win testfile} -body {
list [catch {testfile rmdir td1} msg] [file tail $msg]
-} {1 {td1 ENOENT}}
-test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} {win testfile} {
+} -result {1 {td1 ENOENT}}
+test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} -setup {
cleanup
- list [catch {testfile rmdir ""} msg] $msg
-} {1 ENOENT}
-test winFCmd-6.6 {TclpRemoveDirectory: errno: ENOTDIR} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile rmdir ""
+} -returnCodes error -result ENOENT
+# This next test has a very hokey way of matching...
+test winFCmd-6.6 {TclpRemoveDirectory: errno: ENOTDIR} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
list [catch {testfile rmdir tf1} msg] [file tail $msg]
-} {1 {tf1 ENOTDIR}}
-test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} {win testfile} {
+} -result {1 {tf1 ENOTDIR}}
+test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
testfile rmdir td1
file exists td1
-} {0}
-test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} {win testfile} {
+} -result {0}
+# This next test has a very hokey way of matching...
+test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
list [catch {testfile rmdir tf1} msg] [file tail $msg]
-} {1 {tf1 ENOTDIR}}
-test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} {win testfile testchmod} {
+} -result {1 {tf1 ENOTDIR}}
+test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
file mkdir td1
testchmod 000 td1
testfile rmdir td1
file exists td1
-} {0}
-test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} {win 95 testfile} {
+} -result {0}
+test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} -setup {
cleanup
- list [catch {testfile rmdir nul} msg] $msg
-} {1 {nul EACCES}}
-test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} {win nt testfile} {
+} -constraints {win 95 testfile} -body {
+ testfile rmdir nul
+} -returnCodes error -result {nul EACCES}
+test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} -setup {
cleanup
- set res [list [catch {testfile rmdir /} msg] $msg]
+} -constraints {win nt testfile} -body {
+ testfile rmdir /
# WinXP returns EEXIST, WinNT seems to return EACCES. No policy
# decision has been made as to which is correct.
- regsub {E(ACCES|EXIST)} $res "EACCES or EEXIST"
-} [list 1 [list / EACCES or EEXIST]]
-test winFCmd-6.12 {TclpRemoveDirectory: errno == EACCES} {win 95 testfile} {
+} -returnCodes error -match regexp -result {^/ E(ACCES|EXIST)$}
+# This next test has a very hokey way of matching...
+test winFCmd-6.12 {TclpRemoveDirectory: errno == EACCES} -setup {
cleanup
+} -constraints {win 95 testfile} -body {
createfile tf1
set res [catch {testfile rmdir tf1} msg]
# get rid of path
set msg [list [file tail [lindex $msg 0]] [lindex $msg 1]]
list $res $msg
-} {1 {tf1 ENOTDIR}}
-test winFCmd-6.13 {TclpRemoveDirectory: write-protected} {win testfile testchmod} {
+} -result {1 {tf1 ENOTDIR}}
+test winFCmd-6.13 {TclpRemoveDirectory: write-protected} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
file mkdir td1
testchmod 000 td1
testfile rmdir td1
file exists td1
-} {0}
-test winFCmd-6.14 {TclpRemoveDirectory: check if empty dir} {win 95 testfile} {
+} -result {0}
+# This next test has a very hokey way of matching...
+test winFCmd-6.14 {TclpRemoveDirectory: check if empty dir} -setup {
cleanup
+} -constraints {win 95 testfile} -body {
file mkdir td1/td2
set res [catch {testfile rmdir td1} msg]
# get rid of path
set msg [list [file tail [lindex $msg 0]] [lindex $msg 1]]
list $res $msg
-} {1 {td1 EEXIST}}
-test winFCmd-6.15 {TclpRemoveDirectory: !recursive} {win testfile} {
+} -result {1 {td1 EEXIST}}
+# This next test has a very hokey way of matching...
+test winFCmd-6.15 {TclpRemoveDirectory: !recursive} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1/td2
list [catch {testfile rmdir td1} msg] [file tail $msg]
-} {1 {td1 EEXIST}}
-test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} {win testfile} {
+} -result {1 {td1 EEXIST}}
+test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} -setup {
cleanup
+} -constraints {win testfile} -body {
createfile tf1
- list [catch {testfile rmdir -force tf1} msg] $msg
-} {1 {tf1 ENOTDIR}}
-test winFCmd-6.17 {TclpRemoveDirectory: calls TraverseWinTree} {win testfile} {
+ testfile rmdir -force tf1
+} -returnCodes error -result {tf1 ENOTDIR}
+test winFCmd-6.17 {TclpRemoveDirectory: calls TraverseWinTree} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1/td2
testfile rmdir -force td1
file exists td1
-} {0}
+} -result {0}
-test winFCmd-7.1 {TraverseWinTree: targetPtr == NULL} {win testfile} {
+test winFCmd-7.1 {TraverseWinTree: targetPtr == NULL} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1/td2/td3
testfile rmdir -force td1
file exists td1
-} {0}
-test winFCmd-7.2 {TraverseWinTree: targetPtr != NULL} {win testfile} {
+} -result {0}
+test winFCmd-7.2 {TraverseWinTree: targetPtr != NULL} -setup {
cleanup
+} -constraints {win testfile} -body {
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} {win testfile} {
+} -cleanup {
+ cleanup
+} -result {1 1}
+test winFCmd-7.3 {TraverseWinTree: sourceAttr == -1} -setup {
cleanup
- list [catch {testfile cpdir td1 td2} msg] $msg
-} {1 {td1 ENOENT}}
-test winFCmd-7.4 {TraverseWinTree: source isn't directory} {win testfile} {
+} -constraints {win testfile} -body {
+ testfile cpdir td1 td2
+} -returnCodes error -result {td1 ENOENT}
+test winFCmd-7.4 {TraverseWinTree: source isn't directory} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile td1/tf1 tf1
testfile cpdir td1 td2
contents td2/tf1
-} {tf1}
-test winFCmd-7.5 {TraverseWinTree: call TraversalCopy: DOTREE_F} {win testfile} {
+} -cleanup {
cleanup
+} -result {tf1}
+test winFCmd-7.5 {TraverseWinTree: call TraversalCopy: DOTREE_F} -setup {
+ cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile td1/tf1 tf1
testfile cpdir td1 td2
contents td2/tf1
-} {tf1}
-test winFCmd-7.6 {TraverseWinTree: call TraversalDelete: DOTREE_F} {win testfile} {
+} -cleanup {
cleanup
+} -result {tf1}
+test winFCmd-7.6 {TraverseWinTree: call TraversalDelete: DOTREE_F} -setup {
+ cleanup
+} -constraints {win testfile} -body {
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} {win testfile} {
+} -result {0}
+test winFCmd-7.7 {TraverseWinTree: append \ to source if necessary} -setup {
cleanup
+} -constraints {win testfile} -body {
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} {win 95 cdrom testfile} {
+} -cleanup {
+ cleanup
+} -result {tf1}
+test winFCmd-7.8 {TraverseWinTree: append \ to source if necessary} -body {
# cdrom can return either d:\ or D:/, but we only care about the errcode
- list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1]
-} {1 EACCES} ; # was EEXIST, but changed for win98.
-test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {win nt cdrom testfile} {
- list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1]
-} {1 EACCES}
+ testfile rmdir $cdrom/
+} -constraints {win 95 cdrom testfile} -returnCodes error -match glob \
+ -result {* EACCES} ; # was EEXIST, but changed for win98.
+test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} -body {
+ testfile rmdir $cdrom/
+} -constraints {win nt cdrom testfile} -returnCodes error -match glob \
+ -result {* EACCES}
test winFCmd-7.10 {TraverseWinTree: can't read directory: handle == INVALID} \
{win emptyTest} {
# can't make it happen
} {}
-test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} {win testfile testchmod} {
+test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
file mkdir td1
createfile td1/tf1 tf1
testchmod 000 td1
testfile cpdir td1 td2
list [file exists td2] [file writable td2]
-} {1 1}
-test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} {win testfile} {
+} -cleanup {
+ cleanup
+} -result {1 1}
+test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} -setup {
cleanup
+} -constraints {win testfile} -body {
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} {win testfile} {
+} -result {0}
+test winFCmd-7.13 {TraverseWinTree: append \ to target if necessary} -setup {
cleanup
+} -constraints {win testfile} -body {
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} {win 95 testfile} {
+} -cleanup {
+ cleanup
+} -result {tf1}
+test winFCmd-7.14 {TraverseWinTree: append \ to target if necessary} -setup {
cleanup
+} -constraints {win 95 testfile} -body {
file mkdir td1
- list [catch {testfile cpdir td1 /} msg] $msg
-} {1 {/ EEXIST}}
-test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {win nt testfile} {
+ testfile cpdir td1 /
+} -cleanup {
+ cleanup
+} -returnCodes error -result {/ EEXIST}
+test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} -setup {
cleanup
+} -constraints {win nt testfile} -body {
file mkdir td1
- list [catch {testfile cpdir td1 /} msg] $msg
-} {1 {/ EACCES}}
-test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} {win testfile} {
+ testfile cpdir td1 /
+} -cleanup {
+ cleanup
+} -returnCodes error -result {/ EACCES}
+test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
testfile cpdir td1 td2
-} {}
-test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} {win testfile} {
+} -cleanup {
cleanup
+} -result {}
+test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} -setup {
+ cleanup
+} -constraints {win testfile} -body {
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} \
- {win testfile} {
+} -cleanup {
cleanup
+} -result {td2/td2}
+test winFCmd-7.18 {TraverseWinTree: recurse on files: several files and dir} -setup {
+ cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile td1/tf1
createfile td1/tf2
@@ -750,277 +917,363 @@ test winFCmd-7.18 {TraverseWinTree: recurse on files: several files and dir} \
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} {win testfile testchmod} {
+} -cleanup {
+ cleanup
+} -result {td2/td2 td2/tf1 td2/tf2 td2/tf3 td2/tf4}
+test winFCmd-7.19 {TraverseWinTree: call TraversalCopy: DOTREE_POSTD} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
file mkdir td1
createfile td1/tf1 tf1
testchmod 000 td1
testfile cpdir td1 td2
list [file exists td2] [file writable td2]
-} {1 1}
-test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} \
- {win testfile} {
+} -cleanup {
+ cleanup
+} -result {1 1}
+test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile td1/tf1 tf1
testfile rmdir -force td1
file exists td1
-} {0}
-test winFCmd-7.21 {TraverseWinTree: fill errorPtr} {win testfile} {
+} -result {0}
+test winFCmd-7.21 {TraverseWinTree: fill errorPtr} -setup {
cleanup
- list [catch {testfile cpdir td1 td2} msg] $msg
-} {1 {td1 ENOENT}}
+} -constraints {win testfile} -body {
+ testfile cpdir td1 td2
+} -returnCodes error -result {td1 ENOENT}
-test winFCmd-8.1 {TraversalCopy: DOTREE_F} {win testfile} {
+test winFCmd-8.1 {TraversalCopy: DOTREE_F} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
- list [catch {testfile cpdir td1 td1} msg] $msg
-} {1 {td1 EEXIST}}
-test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} {win testfile testchmod} {
+ testfile cpdir td1 td1
+} -returnCodes error -result {td1 EEXIST}
+test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
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} {win testfile} {
+} -cleanup {
cleanup
+} -result {0 1}
+test winFCmd-8.3 {TraversalCopy: DOTREE_POSTD} -setup {
+ cleanup
+} -constraints {win testfile} -body {
file mkdir td1
testfile cpdir td1 td2
-} {}
+} -cleanup {
+ cleanup
+} -result {}
-test winFCmd-9.1 {TraversalDelete: DOTREE_F} {win testfile} {
+test winFCmd-9.1 {TraversalDelete: DOTREE_F} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1
createfile td1/tf1
testfile rmdir -force td1
-} {}
-test winFCmd-9.2 {TraversalDelete: DOTREE_F} {win 95 testfile} {
+} -result {}
+test winFCmd-9.2 {TraversalDelete: DOTREE_F} -setup {
cleanup
+} -constraints {win 95 testfile} -body {
file mkdir td1
set fd [open td1/tf1 w]
- set msg [list [catch {testfile rmdir -force td1} msg] $msg]
+ testfile rmdir -force td1
+} -cleanup {
close $fd
- set msg
-} {1 {td1\tf1 EACCES}}
-test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} {win testfile testchmod} {
+} -returnCodes error -result {td1\tf1 EACCES}
+test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
file mkdir td1/td2
testchmod 000 td1
testfile rmdir -force td1
file exists td1
-} {0}
-test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} {win testfile} {
+} -result {0}
+test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} -setup {
cleanup
+} -constraints {win testfile} -body {
file mkdir td1/td1/td3/td4/td5
testfile rmdir -force td1
-} {}
+} -result {}
-test winFCmd-10.1 {AttributesPosixError - get} {win} {
+test winFCmd-10.1 {AttributesPosixError - get} -constraints {win} -setup {
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} {win} {
+} -body {
+ file attributes td1 -archive
+} -returnCodes error -result {could not read "td1": no such file or directory}
+test winFCmd-10.2 {AttributesPosixError - set} -constraints {win} -setup {
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} {win} {
- cleanup
- close [open td1 w]
- list [catch {file attributes td1 -archive} msg] $msg [cleanup]
-} {0 1 {}}
-test winFCmd-11.2 {GetWinFileAttributes} {win} {
- cleanup
- close [open td1 w]
- list [catch {file attributes td1 -readonly} msg] $msg [cleanup]
-} {0 0 {}}
-test winFCmd-11.3 {GetWinFileAttributes} {win} {
- cleanup
- close [open td1 w]
- list [catch {file attributes td1 -hidden} msg] $msg [cleanup]
-} {0 0 {}}
-test winFCmd-11.4 {GetWinFileAttributes} {win} {
- cleanup
- close [open td1 w]
- list [catch {file attributes td1 -system} msg] $msg [cleanup]
-} {0 0 {}}
-test winFCmd-11.5 {GetWinFileAttributes} {win} {
- # attr of relative paths that resolve to root was failing
- # don't care about answer, just that test runs.
+} -body {
+ file attributes td1 -archive 0
+} -returnCodes error -result {could not read "td1": no such file or directory}
+test winFCmd-11.1 {GetWinFileAttributes} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ file attributes td1 -archive
+} -cleanup {
+ cleanup
+} -result 1
+test winFCmd-11.2 {GetWinFileAttributes} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ file attributes td1 -readonly
+} -cleanup {
+ cleanup
+} -result 0
+test winFCmd-11.3 {GetWinFileAttributes} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ file attributes td1 -hidden
+} -cleanup {
+ cleanup
+} -result 0
+test winFCmd-11.4 {GetWinFileAttributes} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ file attributes td1 -system
+} -cleanup {
+ cleanup
+} -result 0
+test winFCmd-11.5 {GetWinFileAttributes} -constraints {win} -setup {
set old [pwd]
+} -body {
+ # Attr of relative paths that resolve to root was failing don't care about
+ # answer, just that test runs.
cd c:/
- file attr c:
+ file attr c:
file attr c:.
- file attr .
+ file attr .
+} -cleanup {
cd $old
-} {}
-test winFCmd-11.6 {GetWinFileAttributes} {win} {
+} -match glob -result *
+test winFCmd-11.6 {GetWinFileAttributes} -constraints {win} -body {
file attr c:/ -hidden
-} {0}
+} -result {0}
-test winFCmd-12.1 {ConvertFileNameFormat} {win} {
+test winFCmd-12.1 {ConvertFileNameFormat} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ string tolower [file attributes td1 -longname]
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
-} {0 td1 {}}
-test winFCmd-12.2 {ConvertFileNameFormat} {win} {
+} -result {td1}
+test winFCmd-12.2 {ConvertFileNameFormat} -constraints {win} -setup {
cleanup
+} -body {
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} {win} {
+ createfile td1/td1 {}
+ string tolower [file attributes td1/td1 -longname]
+} -cleanup {
cleanup
+} -result {td1/td1}
+test winFCmd-12.3 {ConvertFileNameFormat} -constraints {win} -setup {
+ cleanup
+} -body {
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} {win} {
- 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} {win} {
+ createfile td1/td3 {}
+ string tolower [file attributes td1/td2/../td3 -longname]
+} -cleanup {
+ cleanup
+} -result {td1/td2/../td3}
+test winFCmd-12.4 {ConvertFileNameFormat} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ string tolower [file attributes ./td1 -longname]
+} -cleanup {
+ cleanup
+} -result {./td1}
+test winFCmd-12.5 {ConvertFileNameFormat: absolute path} -body {
list [file attributes / -longname] [file attributes \\ -longname]
-} {/ /}
-test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} {win} {
+} -constraints {win} -result {/ /}
+test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} -setup {
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 win} {
+} -constraints {win} -body {
+ createfile c:/td1 {}
+ string tolower [file attributes c:/td1 -longname]
+} -cleanup {
+ file delete -force -- c:/td1
+} -result {c:/td1}
+test winFCmd-12.7 {ConvertFileNameFormat} -body {
string tolower [file attributes //bisque/tcl/ws -longname]
-} {//bisque/tcl/ws}
-test winFCmd-12.8 {ConvertFileNameFormat} {win 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 win} {
- cleanup
- close [open td1td1td1 w]
- list [catch {file attributes td1td1td1 -shortname}] [cleanup]
-} {0 {}}
-test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames win} {
- cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
-} {0 td1 {}}
+} -constraints {nonPortable win} -result {//bisque/tcl/ws}
+test winFCmd-12.8 {ConvertFileNameFormat} -setup {
+ cleanup
+} -constraints {win longFileNames} -body {
+ createfile td1 {}
+ string tolower [file attributes td1 -longname]
+} -cleanup {
+ cleanup
+} -result {td1}
+test winFCmd-12.10 {ConvertFileNameFormat} -setup {
+ cleanup
+} -constraints {longFileNames win} -body {
+ createfile td1td1td1 {}
+ file attributes td1td1td1 -shortname
+} -cleanup {
+ cleanup
+} -match glob -result *
+test winFCmd-12.11 {ConvertFileNameFormat} -setup {
+ cleanup
+} -constraints {longFileNames win} -body {
+ createfile td1 {}
+ string tolower [file attributes td1 -shortname]
+} -cleanup {
+ cleanup
+} -result {td1}
-test winFCmd-13.1 {GetWinFileLongName} {win} {
+test winFCmd-13.1 {GetWinFileLongName} -constraints {win} -setup {
cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
-} {0 td1 {}}
+} -body {
+ createfile td1 {}
+ string tolower [file attributes td1 -longname]
+} -cleanup {
+ cleanup
+} -result td1
-test winFCmd-14.1 {GetWinFileShortName} {win} {
+test winFCmd-14.1 {GetWinFileShortName} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ string tolower [file attributes td1 -shortname]
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
-} {0 td1 {}}
+} -result td1
-test winFCmd-15.1 {SetWinFileAttributes} {win} {
- 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} {win} {
- 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} {win} {
- 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} {win} {
- 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} {win} {
- 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} {win} {
- 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} {win} {
- 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} {win} {
- 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} {win} {
- 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} {win cdrom} {
- cleanup
- catch {file attributes $cdfile -archive 1}
-} {1}
-test winFCmd-16.1 {Windows file normalization} {win} {
+test winFCmd-15.1 {SetWinFileAttributes} -constraints {win} -setup {
+ cleanup
+} -body {
+ file attributes td1 -archive 0
+} -returnCodes error -result {could not read "td1": no such file or directory}
+test winFCmd-15.2 {SetWinFileAttributes - archive} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -archive 1] [file attributes td1 -archive]
+} -cleanup {
+ cleanup
+} -result {{} 1}
+test winFCmd-15.3 {SetWinFileAttributes - archive} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -archive 0] [file attributes td1 -archive]
+} -cleanup {
+ cleanup
+} -result {{} 0}
+test winFCmd-15.4 {SetWinFileAttributes - hidden} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -hidden 1] [file attributes td1 -hidden] \
+ [file attributes td1 -hidden 0]
+} -cleanup {
+ cleanup
+} -result {{} 1 {}}
+test winFCmd-15.5 {SetWinFileAttributes - hidden} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -hidden 0] [file attributes td1 -hidden]
+} -cleanup {
+ cleanup
+} -result {{} 0}
+test winFCmd-15.6 {SetWinFileAttributes - readonly} -setup {
+ cleanup
+} -constraints {win} -body {
+ createfile td1 {}
+ list [file attributes td1 -readonly 1] [file attributes td1 -readonly]
+} -cleanup {
+ cleanup
+} -result {{} 1}
+test winFCmd-15.7 {SetWinFileAttributes - readonly} -setup {
+ cleanup
+} -constraints {win} -body {
+ createfile td1 {}
+ list [file attributes td1 -readonly 0] [file attributes td1 -readonly]
+} -cleanup {
+ cleanup
+} -result {{} 0}
+test winFCmd-15.8 {SetWinFileAttributes - system} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -system 1] [file attributes td1 -system]
+} -cleanup {
+ cleanup
+} -result {{} 1}
+test winFCmd-15.9 {SetWinFileAttributes - system} -constraints {win} -setup {
+ cleanup
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -system 0] [file attributes td1 -system]
+} -cleanup {
+ cleanup
+} -result {{} 0}
+test winFCmd-15.10 {SetWinFileAttributes - failing} -setup {
+ cleanup
+} -constraints {win cdrom} -body {
+ file attributes $cdfile -archive 1
+} -returnCodes error -match glob -result *
+
+test winFCmd-16.1 {Windows file normalization} -constraints {win} -body {
list [file normalize c:/] [file normalize C:/]
-} {C:/ C:/}
-test winFCmd-16.2 {Windows file normalization} {win} {
- close [open td1... w]
- set res [file tail [file normalize td1]]
+} -result {C:/ C:/}
+test winFCmd-16.2 {Windows file normalization} -constraints {win} -body {
+ createfile td1... {}
+ file tail [file normalize td1]
+} -cleanup {
file delete td1...
- set res
-} {td1}
-
+} -result {td1}
set pwd [pwd]
set d [string index $pwd 0]
-
-test winFCmd-16.3 {Windows file normalization} {win} {
+test winFCmd-16.3 {Windows file normalization} -constraints {win} -body {
file norm ${d}:foo
-} [file join $pwd foo]
-test winFCmd-16.4 {Windows file normalization} {win} {
+} -result [file join $pwd foo]
+test winFCmd-16.4 {Windows file normalization} -constraints {win} -body {
file norm [string tolower ${d}]:foo
-} [file join $pwd foo]
-test winFCmd-16.5 {Windows file normalization} {win} {
+} -result [file join $pwd foo]
+test winFCmd-16.5 {Windows file normalization} -constraints {win} -body {
file norm ${d}:foo/bar
-} [file join $pwd foo/bar]
-test winFCmd-16.6 {Windows file normalization} {win} {
+} -result [file join $pwd foo/bar]
+test winFCmd-16.6 {Windows file normalization} -constraints {win} -body {
file norm ${d}:foo\\bar
-} [file join $pwd foo/bar]
-test winFCmd-16.7 {Windows file normalization} {win} {
+} -result [file join $pwd foo/bar]
+test winFCmd-16.7 {Windows file normalization} -constraints {win} -body {
file norm /bar
-} "${d}:/bar"
-test winFCmd-16.8 {Windows file normalization} {win} {
+} -result "${d}:/bar"
+test winFCmd-16.8 {Windows file normalization} -constraints {win} -body {
file norm ///bar
-} "${d}:/bar"
-test winFCmd-16.9 {Windows file normalization} {win} {
+} -result "${d}:/bar"
+test winFCmd-16.9 {Windows file normalization} -constraints {win} -body {
file norm /bar/foo
-} "${d}:/bar/foo"
+} -result "${d}:/bar/foo"
if {$d eq "C"} { set dd "D" } else { set dd "C" }
-test winFCmd-16.10 {Windows file normalization} {win} {
+test winFCmd-16.10 {Windows file normalization} -constraints {win} -body {
file norm ${dd}:foo
-} "${dd}:/foo"
-test winFCmd-16.11 {Windows file normalization} -constraints {win cdrom} \
--body {
+} -result "${dd}:/foo"
+test winFCmd-16.11 {Windows file normalization} -body {
cd ${d}:
cd $cdrom
cd ${d}:
cd $cdrom
# Must not crash
set result "no crash"
-} -cleanup {
+} -constraints {win cdrom} -cleanup {
cd $pwd
} -result {no crash}
-
test winFCmd-16.12 {Windows file normalization - no crash} \
-constraints win -setup {
set oldhome ""
@@ -1036,43 +1289,30 @@ test winFCmd-16.12 {Windows file normalization - no crash} \
set ::env(HOME) $oldhome
cd $pwd
} -result {no crash}
-
-test winFCmd-16.13 {Windows file normalization} -constraints win -setup {
+test winFCmd-16.13 {Windows file normalization - absolute HOME} -setup {
set oldhome ""
catch {set oldhome $::env(HOME)}
-} -body {
+} -constraints win -body {
# Test 'cd' normalization when HOME is absolute
- set expectedResult [file normalize ${d}:/]
set ::env(HOME) ${d}:/
cd
- set result [pwd]
- if { [string equal $result $expectedResult] } {
- concat ok
- } else {
- list $result != $expectedResult
- }
+ pwd
} -cleanup {
set ::env(HOME) $oldhome
cd $pwd
-} -result ok
-
-test winFCmd-16.14 {Windows file normalization} -constraints win -setup {
+} -result [file normalize ${d}:/]
+test winFCmd-16.14 {Windows file normalization - relative HOME} -setup {
set oldhome ""
catch {set oldhome $::env(HOME)}
-} -body {
+} -constraints win -body {
# Test 'cd' normalization when HOME is relative
set ::env(HOME) ${d}:
cd
- set result [pwd]
- if { [string equal $result $pwd] } {
- concat ok
- } else {
- list $result != $pwd
- }
+ pwd
} -cleanup {
set ::env(HOME) $oldhome
cd $pwd
-} -result ok
+} -result $pwd
test winFCmd-17.1 {Windows bad permissions cd} -constraints win -body {
set d {}
@@ -1080,7 +1320,7 @@ test winFCmd-17.1 {Windows bad permissions cd} -constraints win -body {
eval lappend d [glob -nocomplain \
-types hidden -dir $dd "System Volume Information"]
}
- # Old versions of Tcl gave a misleading error that the
+ # Old versions of Tcl gave a misleading error that the
# directory in question didn't exist.
if {[llength $d] && [catch {cd [lindex $d 0]} err]} {
regsub ".*: " $err "" err
@@ -1098,68 +1338,52 @@ unset d dd pwd
test winFCmd-18.1 {Windows reserved path names} -constraints win -body {
file pathtype com1
} -result "absolute"
-
test winFCmd-18.1.2 {Windows reserved path names} -constraints win -body {
file pathtype com4
} -result "absolute"
-
test winFCmd-18.1.3 {Windows reserved path names} -constraints win -body {
file pathtype com5
} -result "relative"
-
test winFCmd-18.1.4 {Windows reserved path names} -constraints win -body {
file pathtype lpt3
} -result "absolute"
-
test winFCmd-18.1.5 {Windows reserved path names} -constraints win -body {
file pathtype lpt4
} -result "relative"
-
test winFCmd-18.1.6 {Windows reserved path names} -constraints win -body {
file pathtype nul
} -result "absolute"
-
test winFCmd-18.1.7 {Windows reserved path names} -constraints win -body {
file pathtype null
} -result "relative"
-
test winFCmd-18.2 {Windows reserved path names} -constraints win -body {
file pathtype com1:
} -result "absolute"
-
test winFCmd-18.3 {Windows reserved path names} -constraints win -body {
file pathtype COM1
} -result "absolute"
-
test winFCmd-18.4 {Windows reserved path names} -constraints win -body {
file pathtype CoM1:
} -result "absolute"
-
test winFCmd-18.5 {Windows reserved path names} -constraints win -body {
file normalize com1:
} -result COM1
-
test winFCmd-18.6 {Windows reserved path names} -constraints win -body {
file normalize COM1:
} -result COM1
-
test winFCmd-18.7 {Windows reserved path names} -constraints win -body {
file normalize cOm1
} -result COM1
-
test winFCmd-18.8 {Windows reserved path names} -constraints win -body {
file normalize cOm1:
} -result COM1
-
test winFCmd-19.1 {Windows extended path names} -constraints nt -body {
file normalize //?/c:/windows/win.ini
} -result //?/c:/windows/win.ini
-
test winFCmd-19.2 {Windows extended path names} -constraints nt -body {
file normalize //?/c:/windows/../windows/win.ini
} -result //?/c:/windows/win.ini
-
test winFCmd-19.3 {Windows extended path names} -constraints nt -setup {
set tmpfile [file join $::env(TEMP) tcl[string repeat x 20].tmp]
set tmpfile [file normalize $tmpfile]
@@ -1171,7 +1395,6 @@ test winFCmd-19.3 {Windows extended path names} -constraints nt -setup {
} -cleanup {
catch {file delete $tmpfile}
} -result [list 0 {}]
-
test winFCmd-19.4 {Windows extended path names} -constraints nt -setup {
set tmpfile [file join $::env(TEMP) tcl[string repeat x 20].tmp]
set tmpfile //?/[file normalize $tmpfile]
@@ -1183,7 +1406,6 @@ test winFCmd-19.4 {Windows extended path names} -constraints nt -setup {
} -cleanup {
catch {file delete $tmpfile}
} -result [list 0 {}]
-
test winFCmd-19.5 {Windows extended path names} -constraints nt -setup {
set tmpfile [file join $::env(TEMP) tcl[string repeat x 248].tmp]
set tmpfile [file normalize $tmpfile]
@@ -1195,7 +1417,6 @@ test winFCmd-19.5 {Windows extended path names} -constraints nt -setup {
} -cleanup {
catch {file delete $tmpfile}
} -result [list 1 errormsg]
-
test winFCmd-19.6 {Windows extended path names} -constraints nt -setup {
set tmpfile [file join $::env(TEMP) tcl[string repeat x 248].tmp]
set tmpfile //?/[file normalize $tmpfile]
@@ -1207,7 +1428,6 @@ test winFCmd-19.6 {Windows extended path names} -constraints nt -setup {
} -cleanup {
catch {file delete $tmpfile}
} -result [list 0 {}]
-
test winFCmd-19.7 {Windows extended path names} -constraints nt -setup {
set tmpfile [file join $::env(TEMP) "tcl[pid].tmp "]
set tmpfile [file normalize $tmpfile]
@@ -1219,7 +1439,6 @@ test winFCmd-19.7 {Windows extended path names} -constraints nt -setup {
} -cleanup {
catch {file delete $tmpfile}
} -result [list 0 {} [list tcl[pid].tmp]]
-
test winFCmd-19.8 {Windows extended path names} -constraints nt -setup {
set tmpfile [file join $::env(TEMP) "tcl[pid].tmp "]
set tmpfile //?/[file normalize $tmpfile]
diff --git a/tests/winFile.test b/tests/winFile.test
index 0cefcb5..1c33004 100644
--- a/tests/winFile.test
+++ b/tests/winFile.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: winFile.test,v 1.20 2007/12/14 13:52:55 patthoyts Exp $
+# RCS: @(#) $Id: winFile.test,v 1.21 2008/04/10 00:21:02 dkf Exp $
if {[catch {package require tcltest 2.0.2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
@@ -29,65 +29,63 @@ if {[testConstraint nt] && $::tcl_platform(osVersion) >= 5.0} {
testConstraint win2000 1
}
-test winFile-1.1 {TclpGetUserHome} {win} {
- list [catch {glob ~nosuchuser} msg] $msg
-} {1 {user "nosuchuser" doesn't exist}}
-test winFile-1.2 {TclpGetUserHome} {win nt nonPortable} {
+test winFile-1.1 {TclpGetUserHome} -constraints {win} -body {
+ glob ~nosuchuser
+} -returnCodes error -result {user "nosuchuser" doesn't exist}
+test winFile-1.2 {TclpGetUserHome} -constraints {win nt nonPortable} -body {
# The administrator account should always exist.
-
- catch {glob ~administrator}
-} {0}
-test winFile-1.3 {TclpGetUserHome} {win 95} {
+ glob ~administrator
+} -match glob -result *
+test winFile-1.3 {TclpGetUserHome} -constraints {win 95} -body {
# Find some user in system.ini and then see if they have a home.
set f [open $::env(windir)/system.ini]
- set x 0
- while {![eof $f]} {
- set line [gets $f]
- if {$line == "\[Password Lists]"} {
- gets $f
- set name [lindex [split [gets $f] =] 0]
- if {$name != ""} {
- set x [catch {glob ~$name}]
- break
- }
+ while {[gets $f line] >= 0} {
+ if {$line ne {[Password Lists]}} {
+ continue
+ }
+ gets $f
+ set name [lindex [split [gets $f] =] 0]
+ if {$name ne ""} {
+ return [catch {glob ~$name}]
}
}
- close $f
- set x
-} {0}
+ return 0 ;# didn't find anything...
+} -cleanup {
+ catch {close $f}
+} -result {0}
test winFile-1.4 {TclpGetUserHome} {win nt nonPortable} {
catch {glob ~stanton@workgroup}
} {0}
-test winFile-2.1 {TclpMatchFiles: case sensitivity} {win} {
+test winFile-2.1 {TclpMatchFiles: case sensitivity} -constraints {win} -body {
makeFile {} GlobCapS
- set result [list [glob -nocomplain GlobC*] [glob -nocomplain globc*]]
+ list [glob -nocomplain GlobC*] [glob -nocomplain globc*]
+} -cleanup {
removeFile GlobCapS
- set result
-} {GlobCapS GlobCapS}
-test winFile-2.2 {TclpMatchFiles: case sensitivity} {win} {
+} -result {GlobCapS GlobCapS}
+test winFile-2.2 {TclpMatchFiles: case sensitivity} -constraints {win} -body {
makeFile {} globlower
- set result [list [glob -nocomplain globl*] [glob -nocomplain gLOBl*]]
+ list [glob -nocomplain globl*] [glob -nocomplain gLOBl*]
+} -cleanup {
removeFile globlower
- set result
-} {globlower globlower}
+} -result {globlower globlower}
-test winFile-3.1 {file system} {win testvolumetype} {
- set res "volume types ok"
+test winFile-3.1 {file system} -constraints {win testvolumetype} -setup {
+ set res ""
+} -body {
foreach vol [file volumes] {
# Have to catch in case there is a removable drive (CDROM, floppy)
# with nothing in it.
catch {
- if {![string equal [lindex [file system $vol] 1] [testvolumetype $vol]]} {
- set res "For $vol, we found [file system $vol]\
- and [testvolumetype $vol] are different"
- break
+ if {[lindex [file system $vol] 1] ne [testvolumetype $vol]} {
+ append res "For $vol, we found [file system $vol]\
+ and [testvolumetype $vol] are different\n"
}
}
}
set res
-} {volume types ok}
+} -result {}
proc cacls {fname args} {
string trim [eval [list exec cacls [file nativename $fname]] $args <<y]
@@ -107,7 +105,7 @@ proc getuser {fname} {
}
set owner ""
set tail [file tail $tryname]
- if {[info exists env(OSTYPE)] && [string equal $env(OSTYPE) "msys"]} {
+ if {[info exists env(OSTYPE)] && $env(OSTYPE) eq "msys"} {
set dirtext [exec ls -l $fname]
foreach line [split $dirtext "\n"] {
set owner [lindex $line 2]
@@ -116,21 +114,20 @@ proc getuser {fname} {
set dirtext [exec cmd /c dir /q [file nativename $fname]]
foreach line [split $dirtext "\n"] {
if {[string match -nocase "*$tail" $line]} {
- set attrs [string range $line \
- 0 end-[string length $tail]]
+ set attrs [string range $line 0 end-[string length $tail]]
regexp { [^ \\]+\\.*$} $attrs owner
set owner [string trim $owner]
}
}
}
- if {[string length $owner] == 0} {
+ if {$owner eq ""} {
error "getuser: Owner not found in output of dir/q"
}
return $owner
}
proc test_read {fname} {
- if {[catch {set ifs [open $fname r]}]} {
+ if {[catch {open $fname r} ifs]} {
return 0
}
set readfailed [catch {read $ifs}]
@@ -138,7 +135,7 @@ proc test_read {fname} {
}
proc test_writ {fname} {
- if {[catch {set ofs [open $fname w]}]} {
+ if {[catch {open $fname w} ofs]} {
return 0
}
set writefailed [catch {puts $ofs "Hello"}]
@@ -155,11 +152,10 @@ proc test_access {fname read writ} {
lappend problem "[set $type] != \[test_${type} $fname\]"
}
}
- if {[llength $problem]} {
- return "Problem [join $problem \n]\nActual rights are: [cacls $fname]"
- } else {
- return ""
+ if {![llength $problem]} {
+ return
}
+ return "Problem [join $problem \n]\nActual rights are: [cacls $fname]"
}
# Create the test file