summaryrefslogtreecommitdiffstats
path: root/tests/winFCmd.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/winFCmd.test')
-rw-r--r--tests/winFCmd.test1527
1 files changed, 1003 insertions, 524 deletions
diff --git a/tests/winFCmd.test b/tests/winFCmd.test
index 97fc2d5..28257c6 100644
--- a/tests/winFCmd.test
+++ b/tests/winFCmd.test
@@ -9,15 +9,27 @@
#
# 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.9 2000/04/10 17:19:06 ericm Exp $
-#
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
namespace import -force ::tcltest::*
}
+::tcltest::loadTestedCommands
+catch [list package require -exact Tcltest [info patchlevel]]
+
+# Initialise the test constraints
+
+testConstraint winVista 0
+testConstraint win2000orXP 0
+testConstraint winOlderThan2000 0
+testConstraint testvolumetype [llength [info commands testvolumetype]]
+testConstraint testfile [llength [info commands testfile]]
+testConstraint testchmod [llength [info commands testchmod]]
+testConstraint cdrom 0
+testConstraint exdev 0
+testConstraint longFileNames 0
+
proc createfile {file {string a}} {
set f [open $file w]
puts -nonewline $f $string
@@ -36,74 +48,66 @@ proc cleanup {args} {
foreach p ". $args" {
set x ""
catch {
- set x [glob [file join $p tf*] [file join $p td*]]
+ set x [glob -directory $p tf* td*]
}
if {$x != ""} {
- catch {eval file delete -force -- $x}
+ catch {file delete -force -- {*}$x}
}
}
}
-set ::tcltest::testConstraints(cdrom) 0
-set ::tcltest::testConstraints(exdev) 0
-
-# find a CD-ROM so we can test read-only filesystems.
-
-set cdrom {}
-set nodrive x:
-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} {
- set name ${p}:/dummy~~.fil
- if [catch {set fd [open $name w]}] {
- set err [lindex $errorCode 1]
- if {$cdrom == "" && $err == "EACCES"} {
- set cdrom ${p}:
- }
- if {$err == "ENOENT"} {
- set nodrive ${p}:
- }
+if {[testConstraint winOnly]} {
+ set major [string index $tcl_platform(osVersion) 0]
+ if {[testConstraint nt] && $major > 4} {
+ if {$major > 5} {
+ testConstraint winVista 1
+ } elseif {$major == 5} {
+ testConstraint win2000orXP 1
+ }
} else {
- close $fd
- file delete $name
+ testConstraint winOlderThan2000 1
}
}
+# find a CD-ROM so we can test read-only filesystems.
+
proc findfile {dir} {
- foreach p [glob $dir/*] {
- if {[file type $p] == "file"} {
- return $p
- }
+ foreach p [glob -nocomplain -type f -directory $dir *] {
+ return $p
}
- foreach p [glob $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 ""
}
-if {$cdrom != ""} {
- set ::tcltest::testConstraints(cdrom) 1
- set cdfile [findfile $cdrom]
+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 in {CDFS UDF}} {
+ set cdrom ${p}:
+ set cdfile [findfile $cdrom]
+ testConstraint cdrom 1
+ break
+ }
+ }
}
+# 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:/tf1}
- if {[catch {close [open d:/tf1 w]}] == 0} {
- file delete d:/tf1
- set ::tcltest::testConstraints(exdev) 1
+ catch {file delete d:/TclTmpF.1}
+ if {[catch {createfile d:/TclTmpF.1 {}}] == 0} {
+ file delete d:/TclTmpF.1
+ testConstraint exdev 1
}
}
file delete -force -- td1
-set foo [catch {open td1 w} testfile]
-if {$foo} {
- set ::tcltest::testConstraints(longFileNames) 0
-} else {
+if {![catch {open td1 w} testfile]} {
close $testfile
- set ::tcltest::testConstraints(longFileNames) 1
+ testConstraint longFileNames 1
file delete -force -- td1
}
@@ -123,592 +127,764 @@ 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} {pcOnly cdrom} {
- list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
-} {1 EACCES}
-test winFCmd-1.2 {TclpRenameFile: errno: EEXIST} {pcOnly} {
+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} {pcOnly} {
+ 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} {pcOnly} {
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+ 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} {pcOnly} {
+} -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} {pcOnly} {
+} -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} {pcOnly} {
+ 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} {pcOnly exdev} {
+ 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} {pcOnly} {
+} -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} {pcOnly} {
+ 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} {pcOnly} {
- cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-1.14 {TclpRenameFile: errno: EACCES} {95} {
- cleanup
- createfile tf1
- list [catch {testfile mv tf1 nul} msg] $msg
-} {1 EACCES}
-test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} {nt} {
- 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.14 {TclpRenameFile: errno: EACCES} -setup {
+ cleanup
+} -constraints {win nt winOlderThan2000 testfile} -body {
+ testfile mv nul tf1
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+} -result {0 tf1}
+test winFCmd-1.17 {TclpRenameFile: MoveFile() == FALSE} -setup {
+ cleanup
+} -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 tf1 tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} {pcOnly} {
+} -constraints {win testfile} -body {
+ testfile mv tf1 tf2
+} -returnCodes error -result ENOENT
+test winFCmd-1.19 {TclpRenameFile: errno == EACCES} -setup {
cleanup
- list [catch {testfile mv tf1 tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-1.19 {TclpRenameFile: errno == EACCES} {pcOnly} {
+} -constraints {win win2000orXP testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result EINVAL
+test winFCmd-1.19.1 {TclpRenameFile: errno == EACCES} -setup {
cleanup
- list [catch {testfile mv nul tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-1.20 {TclpRenameFile: src is dir} {nt} {
- # under 95, this would actually succeed and move the current dir out from
- # under the current process!
+} -constraints {win nt winOlderThan2000 testfile} -body {
+ testfile mv nul tf1
+} -returnCodes error -result EACCES
+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!
file delete /tf1
- list [catch {testfile mv [pwd] /tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-1.21 {TclpRenameFile: long src} {pcOnly} {
+ 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} {pcOnly} {
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+ 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} {pcOnly cdrom} {
+} -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} {pcOnly cdrom} {
+ 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} {pcOnly} {
+} -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} {pcOnly} {
+ 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 exist tf1] [file exist tf2]
-} {0 1}
-test winFCmd-1.29 {TclpRenameFile: src is dir} {pcOnly} {
+ list [file exists tf1] [file exists tf2]
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+ 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} {pcOnly} {
+ 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 exist td1] [file exist td2] [file exist td2/td2]
-} {0 1 1}
+ list [file exists td1] [file exists td2] [file exists td2/td2]
+} -result {0 1 1}
test winFCmd-1.33 {TclpRenameFile: After removing dst dir, MoveFile fails} \
- {pcOnly exdev} {
+ -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 {
+ catch {testchmod 666 d:/td1}
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} {pcOnly} {
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+ 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}
-test winFCmd-1.37 {TclpRenameFile: need to restore temp file} {pcOnly} {
- # Can't figure out how to cause this.
+} -cleanup {
+ cleanup
+} -result {tf1}
+test winFCmd-1.37 {TclpRenameFile: need to restore temp file} {win emptyTest} {
+ # Can't figure out how to cause this.
# Need a file that can't be copied.
} {}
-test winFCmd-2.1 {TclpCopyFile: errno: EACCES} {pcOnly cdrom} {
+# If the native filesystem produces 0 for inodes numbers there is no point
+# doing the following test.
+testConstraint winNonZeroInodes [eval {
+ file stat [info nameofexecutable] statExe
+ expr {$statExe(ino) != 0}
+}]
+
+proc MakeFiles {dirname} {
+ set inodes {}
+ set ndx -1
+ while {1} {
+ # upped to 50K for 64bit Server 2008
+ if {$ndx > 50000} {
+ return -code error "limit reached without finding a collistion."
+ }
+ set filename [file join $dirname Test[incr ndx]]
+ set f [open $filename w]
+ close $f
+ file stat $filename stat
+ if {[set n [lsearch -exact -integer $inodes $stat(ino)]] != -1} {
+ return [list [file join $dirname Test$n] $filename]
+ }
+ lappend inodes $stat(ino)
+ unset stat
+ }
+}
+
+test winFCmd-1.38 {TclpRenameFile: check rename of conflicting inodes} -setup {
+ cleanup
+} -constraints {win winNonZeroInodes} -body {
+ file mkdir td1
+ foreach {a b} [MakeFiles td1] break
+ file rename -force $a $b
+ file exists $a
+} -cleanup {
cleanup
- list [catch {testfile cp $cdfile $cdrom/dummy~~.fil} msg] $msg
-} {1 EACCES}
-test winFCmd-2.2 {TclpCopyFile: errno: EISDIR} {pcOnly} {
+} -result {0}
+
+
+test winFCmd-2.1 {TclpCopyFile: errno: EACCES} -setup {
cleanup
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+ testfile cp tf1 td1
+} -cleanup {
cleanup
- list [catch {testfile cp tf1 tf2} msg] $msg
-} {1 ENOENT}
-test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} {pcOnly} {
+} -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} {pcOnly} {
+} -constraints {win testfile} -body {
+ testfile cp tf1 tf2
+} -returnCodes error -result ENOENT
+test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} -setup {
cleanup
- createfile tf1
- list [catch {testfile cp tf1 ""} msg] $msg
-} {1 ENOENT}
-test winFCmd-2.7 {TclpCopyFile: errno: EACCES} {95} {
+} -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
- set fd [open tf2 w]
- set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
- close $fd
- set msg
-} {1 EACCES}
-test winFCmd-2.8 {TclpCopyFile: errno: EACCES} {nt} {
+ testfile cp tf1 ""
+} -cleanup {
+ cleanup
+} -returnCodes error -result ENOENT
+test winFCmd-2.7 {TclpCopyFile: errno: EACCES} -setup {
cleanup
- list [catch {testfile cp nul tf1} msg] $msg
-} {1 EACCES}
-test winFCmd-2.9 {TclpCopyFile: errno: ENOENT} {95} {
+} -constraints {win win2000orXP testfile} -body {
+ testfile cp nul tf1
+} -returnCodes error -result EINVAL
+test winFCmd-2.8 {TclpCopyFile: errno: EACCES} -setup {
cleanup
- list [catch {testfile cp nul tf1} msg] $msg
-} {1 ENOENT}
-test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
+} -constraints {win nt winOlderThan2000 testfile} -body {
+ testfile cp nul tf1
+} -returnCodes error -result EACCES
+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} {pcOnly} {
+} -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} {pcOnly} {
+} -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} {pcOnly} {
+} -cleanup {
+ catch {testchmod 666 tf1}
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} {pcOnly} {
+ 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} {pcOnly} {
+ 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} {pcOnly} {
+ 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} {pcOnly} {
+ 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} {95} {
+} -cleanup {
+ catch {testchmod 666 tf2}
cleanup
- 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}
+} -result {1 tf1}
-test winFCmd-3.1 {TclpDeleteFile: errno: EACCES} {pcOnly cdrom} {
- list [catch {testfile rm $cdfile $cdrom/dummy~~.fil} msg] $msg
-} {1 EACCES}
-test winFCmd-3.2 {TclpDeleteFile: errno: EISDIR} {pcOnly} {
+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} {pcOnly} {
+ testfile rm td1
+} -cleanup {
cleanup
- list [catch {testfile rm tf1} msg] $msg
-} {1 ENOENT}
-test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} {pcOnly} {
+} -returnCodes error -result EISDIR
+test winFCmd-3.3 {TclpDeleteFile: errno: ENOENT} -setup {
cleanup
- list [catch {testfile rm ""} msg] $msg
-} {1 ENOENT}
-test winFCmd-3.5 {TclpDeleteFile: errno: EACCES} {pcOnly} {
+} -constraints {win testfile} -body {
+ testfile rm tf1
+} -returnCodes error -result ENOENT
+test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} -setup {
cleanup
+} -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} {pcOnly} {
cleanup
- list [catch {testfile rm nul} msg] $msg
-} {1 EACCES}
-test winFCmd-3.7 {TclpDeleteFile: DeleteFile succeeds} {pcOnly} {
+} -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 exist tf1
-} {0}
-test winFCmd-3.8 {TclpDeleteFile: DeleteFile fails} {pcOnly} {
+ file exists tf1
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+} -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} {pcOnly} {
+} -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}
+ catch {testchmod 666 tf1}
+ cleanup
+} -returnCodes error -result EACCES
-test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} {nt cdrom} {
- list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
-} {1 EACCES}
-test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} {95 cdrom} {
- list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
-} {1 ENOSPC}
-test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} {pcOnly} {
+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.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} {pcOnly} {
+ testfile mkdir td1
+} -cleanup {
cleanup
- list [catch {testfile mkdir td1/td2} msg] $msg
-} {1 ENOENT}
-test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} {pcOnly} {
+} -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} {pcOnly} {
+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} {pcOnly} {
+test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} -setup {
cleanup
+} -constraints {winVista testfile testchmod} -body {
file mkdir td1
testchmod 000 td1
testfile rmdir td1
- file exist td1
-} {0}
-test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} {pcOnly} {
+ file exists td1
+} -returnCodes error -cleanup {
+ catch {testchmod 666 td1}
+ cleanup
+} -result {td1 EACCES}
+# 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] $msg
-} {1 {td1 EEXIST}}
-test winFCmd-6.3 {TclpRemoveDirectory: errno: EACCES} {pcOnly} {
+ list [catch {testfile rmdir td1} msg] [file tail $msg]
+} -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} {pcOnly} {
+# This next test has a very hokey way of matching...
+test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} -setup {
cleanup
- list [catch {testfile rmdir td1} msg] $msg
-} {1 {td1 ENOENT}}
-test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} {
+} -constraints {win testfile} -body {
+ list [catch {testfile rmdir td1} msg] [file tail $msg]
+} -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} {pcOnly} {
+} -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] $msg
-} {1 {tf1 ENOTDIR}}
-test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} {pcOnly} {
+ list [catch {testfile rmdir tf1} msg] [file tail $msg]
+} -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} {pcOnly} {
+} -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] $msg
-} {1 {tf1 ENOTDIR}}
-test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} {pcOnly} {
+ list [catch {testfile rmdir tf1} msg] [file tail $msg]
+} -result {1 {tf1 ENOTDIR}}
+test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} -setup {
cleanup
+} -constraints {winVista testfile testchmod} -body {
file mkdir td1
testchmod 000 td1
testfile rmdir td1
file exists td1
-} {0}
-test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} {95} {
+} -returnCodes error -cleanup {
+ catch {testchmod 666 td1}
cleanup
- list [catch {testfile rmdir nul} msg] $msg
-} {1 {nul EACCES}}
-test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} {nt} {
+} -result {td1 EACCES}
+test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} -setup {
cleanup
- list [catch {testfile rmdir /} msg] $msg
-} {1 {\ EACCES}}
-test winFCmd-6.12 {TclpRemoveDirectory: errno == EACCES} {95} {
- cleanup
- createfile tf1
- list [catch {testfile rmdir tf1} msg] $msg
-} {1 {tf1 ENOTDIR}}
-test winFCmd-6.13 {TclpRemoveDirectory: write-protected} {pcOnly} {
+} -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.
+} -returnCodes error -match regexp -result {^/ E(ACCES|EXIST)$}
+test winFCmd-6.13 {TclpRemoveDirectory: write-protected} -setup {
cleanup
+} -constraints {winVista 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} {95} {
+} -cleanup {
+ catch {testchmod 666 td1}
cleanup
- file mkdir td1/td2
- list [catch {testfile rmdir td1} msg] $msg
-} {1 {td1 EEXIST}}
-test winFCmd-6.15 {TclpRemoveDirectory: !recursive} {pcOnly} {
+} -returnCodes error -result {td1 EACCES}
+# 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] $msg
-} {1 {td1 EEXIST}}
-test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} {pcOnly} {
+ list [catch {testfile rmdir td1} msg] [file tail $msg]
+} -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} {pcOnly} {
+ 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} {pcOnly} {
+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} {pcOnly} {
+} -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} {pcOnly} {
+} -cleanup {
cleanup
- list [catch {testfile cpdir td1 td2} msg] $msg
-} {1 {td1 ENOENT}}
-test winFCmd-7.4 {TraverseWinTree: source isn't directory} {pcOnly} {
+} -result {1 1}
+test winFCmd-7.3 {TraverseWinTree: sourceAttr == -1} -setup {
cleanup
+} -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} {pcOnly} {
+} -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} {pcOnly} {
+} -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} {pcOnly} {
+} -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} {95 cdrom} {
- list [catch {testfile rmdir $cdrom/} msg] $msg
-} "1 {$cdrom\\ EEXIST}"
-test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {nt cdrom} {
- list [catch {testfile rmdir $cdrom/} msg] $msg
-} "1 {$cdrom\\ EACCES}"
+} -cleanup {
+ cleanup
+} -result {tf1}
+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} \
- {pcOnly} {
+ {win emptyTest} {
# can't make it happen
} {}
-test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} {pcOnly} {
+test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} -setup {
cleanup
+} -constraints {win testfile testchmod} -body {
file mkdir td1
- testchmod 000 td1
createfile td1/tf1 tf1
+ testchmod 000 td1
testfile cpdir td1 td2
list [file exists td2] [file writable td2]
-} {1 0}
-test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} {pcOnly} {
+} -cleanup {
+ catch {testchmod 666 td1}
+ 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} {pcOnly} {
+} -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} {95} {
+} -cleanup {
cleanup
- file mkdir td1
- list [catch {testfile cpdir td1 /} msg] $msg
-} {1 {\ EEXIST}}
-test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {nt} {
+} -result {tf1}
+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} {pcOnly} {
+ testfile cpdir td1 /
+} -cleanup {
+ cleanup
+ # Windows7 returns EEXIST, XP returns EACCES
+} -returnCodes error -match regexp -result {^/ E(ACCES|EXIST)$}
+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} {pcOnly} {
+} -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} \
- {pcOnly} {
+} -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
@@ -717,224 +893,535 @@ 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} {pcOnly} {
+} -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
- testchmod 000 td1
createfile td1/tf1 tf1
+ testchmod 000 td1
testfile cpdir td1 td2
list [file exists td2] [file writable td2]
-} {1 0}
-test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} \
- {pcOnly} {
+} -cleanup {
+ catch {testchmod 666 td1}
+ 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} {pcOnly} {
+} -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} {pcOnly} {
+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} {pcOnly} {
+ 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} {pcOnly} {
+} -cleanup {
+ catch {testchmod 666 td1}
+ 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} {pcOnly} {
+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} {95} {
- cleanup
- file mkdir td1
- set fd [open td1/tf1 w]
- set msg [list [catch {testfile rmdir -force td1} msg] $msg]
- close $fd
- set msg
-} {1 {td1\tf1 EACCES}}
-test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} {pcOnly} {
+} -result {}
+test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} -setup {
cleanup
+} -constraints {winVista 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} {pcOnly} {
+} -cleanup {
+ catch {testchmod 666 td1}
+ cleanup
+} -returnCodes error -result {td1 EACCES}
+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} {pcOnly} {
+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} {pcOnly} {
+} -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}}
+} -body {
+ file attributes td1 -archive 0
+} -returnCodes error -result {could not read "td1": no such file or directory}
-test winFCmd-11.1 {GetWinFileAttributes} {pcOnly} {
+test winFCmd-11.1 {GetWinFileAttributes} -constraints {win} -setup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -archive} msg] $msg [cleanup]
-} {0 1 {}}
-test winFCmd-11.2 {GetWinFileAttributes} {pcOnly} {
+} -body {
+ createfile td1 {}
+ file attributes td1 -archive
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -readonly} msg] $msg [cleanup]
-} {0 0 {}}
-test winFCmd-11.3 {GetWinFileAttributes} {pcOnly} {
+} -result 1
+test winFCmd-11.2 {GetWinFileAttributes} -constraints {win} -setup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -hidden} msg] $msg [cleanup]
-} {0 0 {}}
-test winFCmd-11.4 {GetWinFileAttributes} {pcOnly} {
+} -body {
+ createfile td1 {}
+ file attributes td1 -readonly
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -system} msg] $msg [cleanup]
-} {0 0 {}}
-test winfcmd-11.5 {GetWinFileAttributes} {pcOnly} {
- # attr of relative paths that resolve to root was failing
- # don't care about answer, just that test runs.
-
+} -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
-} {}
+} -match glob -result *
+test winFCmd-11.6 {GetWinFileAttributes} -constraints {win} -body {
+ file attr c:/ -hidden
+} -result {0}
-test winFCmd-12.1 {ConvertFileNameFormat} {pcOnly} {
+test winFCmd-12.1 {ConvertFileNameFormat} -constraints {win} -setup {
cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
-} {0 td1 {}}
-test winFCmd-12.2 {ConvertFileNameFormat} {pcOnly} {
+} -body {
+ createfile td1 {}
+ string tolower [file attributes td1 -longname]
+} -cleanup {
cleanup
+} -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} {pcOnly} {
+ 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} {pcOnly} {
- cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes ./td1 -longname]} msg] $msg [cleanup]
-} {0 ./td1 {}}
-test winFCmd-12.5 {ConvertFileNameFormat: absolute path} {pcOnly} {
+ 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} {pcOnly} {
+} -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 pcOnly} {
+} -constraints {win win2000orXP} -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} {pcOnly longFileNames} {
+} -constraints {nonPortable win} -result {//bisque/tcl/ws}
+test winFCmd-12.8 {ConvertFileNameFormat} -setup {
cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
-} {0 td1 {}}
-test winFCmd-12.10 {ConvertFileNameFormat} {longFileNames pcOnly} {
+} -constraints {win longFileNames} -body {
+ createfile td1 {}
+ string tolower [file attributes td1 -longname]
+} -cleanup {
cleanup
- close [open td1td1td1 w]
- list [catch {file attributes td1td1td1 -shortname}] [cleanup]
-} {0 {}}
-test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames pcOnly} {
+} -result {td1}
+test winFCmd-12.10 {ConvertFileNameFormat} -setup {
cleanup
- close [open td1 w]
- list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
-} {0 td1 {}}
+} -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} {pcOnly} {
+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} {pcOnly} {
+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} {pcOnly} {
+test winFCmd-15.1 {SetWinFileAttributes} -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-15.2 {SetWinFileAttributes - archive} {pcOnly} {
+} -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
- close [open td1 w]
- list [catch {file attributes td1 -archive 1} msg] $msg [file attributes td1 -archive] [cleanup]
-} {0 {} 1 {}}
-test winFCmd-15.3 {SetWinFileAttributes - archive} {pcOnly} {
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -archive 1] [file attributes td1 -archive]
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -archive 0} msg] $msg [file attributes td1 -archive] [cleanup]
-} {0 {} 0 {}}
-test winFCmd-15.4 {SetWinFileAttributes - hidden} {pcOnly} {
+} -result {{} 1}
+test winFCmd-15.3 {SetWinFileAttributes - archive} -constraints {win} -setup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -hidden 1} msg] $msg [file attributes td1 -hidden] [file attributes td1 -hidden 0] [cleanup]
-} {0 {} 1 {} {}}
-test winFCmd-15.5 {SetWinFileAttributes - hidden} {pcOnly} {
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -archive 0] [file attributes td1 -archive]
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -hidden 0} msg] $msg [file attributes td1 -hidden] [cleanup]
-} {0 {} 0 {}}
-test winFCmd-15.6 {SetWinFileAttributes - readonly} {pcOnly} {
+} -result {{} 0}
+test winFCmd-15.4 {SetWinFileAttributes - hidden} -constraints {win} -setup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -readonly 1} msg] $msg [file attributes td1 -readonly] [cleanup]
-} {0 {} 1 {}}
-test winFCmd-15.7 {SetWinFileAttributes - readonly} {pcOnly} {
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -hidden 1] [file attributes td1 -hidden] \
+ [file attributes td1 -hidden 0]
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -readonly 0} msg] $msg [file attributes td1 -readonly] [cleanup]
-} {0 {} 0 {}}
-test winFCmd-15.8 {SetWinFileAttributes - system} {pcOnly} {
+} -result {{} 1 {}}
+test winFCmd-15.5 {SetWinFileAttributes - hidden} -constraints {win} -setup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -system 1} msg] $msg [file attributes td1 -system] [cleanup]
-} {0 {} 1 {}}
-test winFCmd-15.9 {SetWinFileAttributes - system} {pcOnly} {
+} -body {
+ createfile td1 {}
+ list [file attributes td1 -hidden 0] [file attributes td1 -hidden]
+} -cleanup {
cleanup
- close [open td1 w]
- list [catch {file attributes td1 -system 0} msg] $msg [file attributes td1 -system] [cleanup]
-} {0 {} 0 {}}
-test winFCmd-15.10 {SetWinFileAttributes - failing} {pcOnly cdrom} {
+} -result {{} 0}
+test winFCmd-15.6 {SetWinFileAttributes - readonly} -setup {
cleanup
- catch {file attributes $cdfile -archive 1}
-} {1}
+} -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:/]
+} -result {C:/ C:/}
+test winFCmd-16.2 {Windows file normalization} -constraints {win} -body {
+ createfile td1... {}
+ file tail [file normalize td1]
+} -cleanup {
+ file delete td1...
+} -result {td1}
+set pwd [pwd]
+set d [string index $pwd 0]
+test winFCmd-16.3 {Windows file normalization} -constraints {win} -body {
+ file norm ${d}:foo
+} -result [file join $pwd foo]
+test winFCmd-16.4 {Windows file normalization} -constraints {win} -body {
+ file norm [string tolower ${d}]:foo
+} -result [file join $pwd foo]
+test winFCmd-16.5 {Windows file normalization} -constraints {win} -body {
+ file norm ${d}:foo/bar
+} -result [file join $pwd foo/bar]
+test winFCmd-16.6 {Windows file normalization} -constraints {win} -body {
+ file norm ${d}:foo\\bar
+} -result [file join $pwd foo/bar]
+test winFCmd-16.7 {Windows file normalization} -constraints {win} -body {
+ file norm /bar
+} -result "${d}:/bar"
+test winFCmd-16.8 {Windows file normalization} -constraints {win} -body {
+ file norm ///bar
+} -result "${d}:/bar"
+test winFCmd-16.9 {Windows file normalization} -constraints {win} -body {
+ file norm /bar/foo
+} -result "${d}:/bar/foo"
+if {$d eq "C"} { set dd "D" } else { set dd "C" }
+test winFCmd-16.10 {Windows file normalization} -constraints {win} -body {
+ file norm ${dd}:foo
+} -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"
+} -constraints {win cdrom} -cleanup {
+ cd $pwd
+} -result {no crash}
+test winFCmd-16.12 {Windows file normalization - no crash} \
+ -constraints win -setup {
+ set oldhome ""
+ catch {set oldhome $::env(HOME)}
+} -body {
+ set expectedResult [file normalize ${d}:]
+ set ::env(HOME) ${d}:
+ cd
+ # At one point this led to an infinite recursion in Tcl
+ set result [pwd]; # <- Must not crash
+ set result "no crash"
+} -cleanup {
+ set ::env(HOME) $oldhome
+ cd $pwd
+} -result {no crash}
+test winFCmd-16.13 {Windows file normalization - absolute HOME} -setup {
+ set oldhome ""
+ catch {set oldhome $::env(HOME)}
+} -constraints win -body {
+ # Test 'cd' normalization when HOME is absolute
+ set ::env(HOME) ${d}:/
+ cd
+ pwd
+} -cleanup {
+ set ::env(HOME) $oldhome
+ cd $pwd
+} -result [file normalize ${d}:/]
+test winFCmd-16.14 {Windows file normalization - relative HOME} -setup {
+ set oldhome ""
+ catch {set oldhome $::env(HOME)}
+} -constraints win -body {
+ # Test 'cd' normalization when HOME is relative
+ set ::env(HOME) ${d}:
+ cd
+ pwd
+} -cleanup {
+ set ::env(HOME) $oldhome
+ cd $pwd
+} -result $pwd
+
+test winFCmd-17.1 {Windows bad permissions cd} -constraints win -body {
+ set d {}
+ foreach dd {c:/ d:/ e:/} {
+ eval lappend d [glob -nocomplain \
+ -types hidden -dir $dd "System Volume Information"]
+ }
+ # 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
+ set err
+ } else {
+ set err "permission denied"
+ }
+} -cleanup {
+ cd $pwd
+} -result "permission denied"
+
+cd $pwd
+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]
+} -body {
+ list [catch {
+ set f [open $tmpfile [list WRONLY CREAT]]
+ close $f
+ } res] $res
+} -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]
+} -body {
+ list [catch {
+ set f [open $tmpfile [list WRONLY CREAT]]
+ close $f
+ } res] $res
+} -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]
+} -body {
+ list [catch {
+ set f [open $tmpfile [list WRONLY CREAT]]
+ close $f
+ } res] $res
+} -cleanup {
+ catch {file delete $tmpfile}
+} -result [list 0 {}]
+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]
+} -body {
+ list [catch {
+ set f [open $tmpfile [list WRONLY CREAT]]
+ close $f
+ } res] $res
+} -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]
+} -body {
+ list [catch {
+ set f [open $tmpfile [list WRONLY CREAT]]
+ close $f
+ } res] $res [glob -directory $::env(TEMP) -tails tcl[pid].*]
+} -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]
+} -body {
+ list [catch {
+ set f [open $tmpfile [list WRONLY CREAT]]
+ close $f
+ } res] $res [glob -directory $::env(TEMP) -tails tcl[pid].*]
+} -cleanup {
+ catch {file delete $tmpfile}
+} -result [list 0 {} [list "tcl[pid].tmp "]]
# This block of code used to occur after the "return" call, so I'm
# commenting it out and assuming that this code is still under construction.
@@ -968,14 +1455,6 @@ cleanup
::tcltest::cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
+# Local Variables:
+# mode: tcl
+# End: