os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winFCmd.test
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 # This file tests the tclWinFCmd.c file.
     2 #
     3 # This file contains a collection of tests for one or more of the Tcl
     4 # built-in commands.  Sourcing this file into Tcl runs the tests and
     5 # generates output for errors.  No output means no errors were found.
     6 #
     7 # Copyright (c) 1996-1997 Sun Microsystems, Inc.
     8 # Copyright (c) 1998-1999 by Scriptics Corporation.
     9 #
    10 # See the file "license.terms" for information on usage and redistribution
    11 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    12 #
    13 # RCS: @(#) $Id: winFCmd.test,v 1.20.2.9 2006/03/19 22:47:30 vincentdarley Exp $
    14 #
    15 
    16 if {[lsearch [namespace children] ::tcltest] == -1} {
    17     package require tcltest
    18     namespace import -force ::tcltest::*
    19 }
    20 
    21 proc createfile {file {string a}} {
    22     set f [open $file w]
    23     puts -nonewline $f $string
    24     close $f
    25     return $string
    26 }
    27 
    28 proc contents {file} {
    29     set f [open $file r]
    30     set r [read $f]
    31     close $f
    32     set r
    33 }
    34 
    35 proc cleanup {args} {
    36     foreach p ". $args" {
    37 	set x ""
    38 	catch {
    39 	    set x [glob -directory $p tf* td*]
    40 	}
    41 	if {$x != ""} {
    42 	    catch {eval file delete -force -- $x}
    43 	}
    44     }
    45 }
    46 
    47 if {[string equal $tcl_platform(platform) "windows"]} {
    48     if {[string equal $tcl_platform(os) "Windows NT"] \
    49       && [string equal [string index $tcl_platform(osVersion) 0] "5"]} {
    50 	tcltest::testConstraint win2000orXP 1
    51 	tcltest::testConstraint winOlderThan2000 0
    52     } else {
    53 	tcltest::testConstraint win2000orXP 0
    54 	tcltest::testConstraint winOlderThan2000 1
    55     }
    56 } else {
    57     tcltest::testConstraint win2000orXP 0
    58     tcltest::testConstraint winOlderThan2000 0
    59 }
    60 
    61 set ::tcltest::testConstraints(cdrom) 0
    62 set ::tcltest::testConstraints(exdev) 0
    63 
    64 # find a CD-ROM so we can test read-only filesystems.
    65 
    66 set cdrom {}
    67 if { [info commands ::testvolumetype] ne {} } {
    68     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} {
    69         if { ! [catch { testvolumetype ${p}: } result] && $result eq {CDFS} } {
    70 	    set cdrom ${p}:
    71 	}
    72     }
    73 }
    74 
    75 proc findfile {dir} {
    76     foreach p [glob $dir/*] {
    77         if {[file type $p] == "file"} {
    78 	    return $p
    79 	}
    80     }
    81     foreach p [glob $dir/*] {
    82         if {[file type $p] == "directory"} {
    83 	    set f [findfile $p]
    84 	    if {$f != ""} {
    85 	        return $f
    86 	    }
    87 	}
    88     }
    89     return ""
    90 }
    91 
    92 if {$cdrom != ""} {
    93     set ::tcltest::testConstraints(cdrom) 1
    94     set cdfile [findfile $cdrom]
    95 }
    96 
    97 if {[file exists c:/] && [file exists d:/]} {
    98     catch {file delete d:/tf1}
    99     if {[catch {close [open d:/tf1 w]}] == 0} {
   100 	file delete d:/tf1
   101 	set ::tcltest::testConstraints(exdev) 1
   102     }
   103 }
   104 
   105 file delete -force -- td1
   106 set foo [catch {open td1 w} testfile]
   107 if {$foo} {
   108     set ::tcltest::testConstraints(longFileNames) 0
   109 } else {
   110     close $testfile
   111     set ::tcltest::testConstraints(longFileNames) 1
   112     file delete -force -- td1
   113 }
   114 
   115 # A really long file name
   116 # length of longname is 1216 chars, which should be greater than any static
   117 # buffer or allowable filename.
   118 
   119 set longname "abcdefghihjllmnopqrstuvwxyz01234567890"
   120 append longname $longname
   121 append longname $longname
   122 append longname $longname
   123 append longname $longname
   124 append longname $longname
   125 
   126 # Uses the "testfile" command instead of the "file" command.  The "file"
   127 # command provides several layers of sanity checks on the arguments and
   128 # it can be difficult to actually forward "insane" arguments to the
   129 # low-level posix emulation layer.
   130 
   131 test winFCmd-1.1 {TclpRenameFile: errno: EACCES} {pcOnly cdrom} {
   132     list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
   133 } {1 EACCES}
   134 test winFCmd-1.2 {TclpRenameFile: errno: EEXIST} {pcOnly} {
   135     cleanup
   136     file mkdir td1/td2/td3
   137     file mkdir td2
   138     list [catch {testfile mv td2 td1/td2} msg] $msg
   139 } {1 EEXIST} 
   140 test winFCmd-1.3 {TclpRenameFile: errno: EINVAL} {pcOnly} {
   141     cleanup
   142     list [catch {testfile mv / td1} msg] $msg
   143 } {1 EINVAL}
   144 test winFCmd-1.4 {TclpRenameFile: errno: EINVAL} {pcOnly} {
   145     cleanup
   146     file mkdir td1
   147     list [catch {testfile mv td1 td1/td2} msg] $msg
   148 } {1 EINVAL}
   149 test winFCmd-1.5 {TclpRenameFile: errno: EISDIR} {pcOnly} {
   150     cleanup
   151     file mkdir td1
   152     createfile tf1
   153     list [catch {testfile mv tf1 td1} msg] $msg
   154 } {1 EISDIR}
   155 test winFCmd-1.6 {TclpRenameFile: errno: ENOENT} {pcOnly} {
   156     cleanup
   157     list [catch {testfile mv tf1 tf2} msg] $msg
   158 } {1 ENOENT}
   159 test winFCmd-1.7 {TclpRenameFile: errno: ENOENT} {pcOnly} {
   160     cleanup
   161     list [catch {testfile mv "" tf2} msg] $msg
   162 } {1 ENOENT}
   163 test winFCmd-1.8 {TclpRenameFile: errno: ENOENT} {pcOnly} {
   164     cleanup
   165     createfile tf1
   166     list [catch {testfile mv tf1 ""} msg] $msg
   167 } {1 ENOENT}
   168 test winFCmd-1.9 {TclpRenameFile: errno: ENOTDIR} {pcOnly} {
   169     cleanup
   170     file mkdir td1
   171     createfile tf1
   172     list [catch {testfile mv td1 tf1} msg] $msg
   173 } {1 ENOTDIR}
   174 test winFCmd-1.10 {TclpRenameFile: errno: EXDEV} {pcOnly exdev} {
   175     file delete -force d:/tf1
   176     file mkdir c:/tf1
   177     set msg [list [catch {testfile mv c:/tf1 d:/tf1} msg] $msg]
   178     file delete -force c:/tf1
   179     set msg
   180 } {1 EXDEV}
   181 test winFCmd-1.11 {TclpRenameFile: errno: EACCES} {pcOnly} {
   182     cleanup
   183     set fd [open tf1 w]
   184     set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
   185     close $fd
   186     set msg
   187 } {1 EACCES}
   188 test winFCmd-1.12 {TclpRenameFile: errno: EACCES} {pcOnly} {
   189     cleanup
   190     createfile tf1
   191     set fd [open tf2 w]
   192     set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
   193     close $fd
   194     set msg
   195 } {1 EACCES}
   196 test winFCmd-1.13 {TclpRenameFile: errno: EACCES} {pcOnly win2000orXP} {
   197     cleanup
   198     list [catch {testfile mv nul tf1} msg] $msg
   199 } {1 EINVAL}
   200 test winFCmd-1.13.1 {TclpRenameFile: errno: EACCES} {pcOnly winOlderThan2000} {
   201     cleanup
   202     list [catch {testfile mv nul tf1} msg] $msg
   203 } {1 EACCES}
   204 test winFCmd-1.14 {TclpRenameFile: errno: EACCES} {pcOnly 95} {
   205     cleanup
   206     createfile tf1
   207     list [catch {testfile mv tf1 nul} msg] $msg
   208 } {1 EACCES}
   209 test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} {pcOnly nt} {
   210     cleanup
   211     createfile tf1
   212     list [catch {testfile mv tf1 nul} msg] $msg
   213 } {1 EEXIST}
   214 test winFCmd-1.16 {TclpRenameFile: MoveFile() != FALSE} {pcOnly} {
   215     cleanup
   216     createfile tf1 tf1
   217     testfile mv tf1 tf2
   218     list [file exists tf1] [contents tf2]
   219 } {0 tf1}
   220 test winFCmd-1.17 {TclpRenameFile: MoveFile() == FALSE} {pcOnly} {
   221     cleanup
   222     list [catch {testfile mv tf1 tf2} msg] $msg
   223 } {1 ENOENT} 
   224 test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} {pcOnly} {
   225     cleanup
   226     list [catch {testfile mv tf1 tf2} msg] $msg
   227 } {1 ENOENT} 
   228 test winFCmd-1.19 {TclpRenameFile: errno == EACCES} {pcOnly win2000orXP} {
   229     cleanup
   230     list [catch {testfile mv nul tf1} msg] $msg
   231 } {1 EINVAL}
   232 test winFCmd-1.19.1 {TclpRenameFile: errno == EACCES} {pcOnly winOlderThan2000} {
   233     cleanup
   234     list [catch {testfile mv nul tf1} msg] $msg
   235 } {1 EACCES}
   236 test winFCmd-1.20 {TclpRenameFile: src is dir} {pcOnly nt} {
   237     # under 95, this would actually succeed and move the current dir out from 
   238     # under the current process!
   239     cleanup
   240     file delete /tf1
   241     list [catch {testfile mv [pwd] /tf1} msg] $msg
   242 } {1 EACCES}
   243 test winFCmd-1.21 {TclpRenameFile: long src} {pcOnly} {
   244     cleanup
   245     list [catch {testfile mv $longname tf1} msg] $msg
   246 } {1 ENAMETOOLONG}
   247 test winFCmd-1.22 {TclpRenameFile: long dst} {pcOnly} {
   248     cleanup
   249     createfile tf1
   250     list [catch {testfile mv tf1 $longname} msg] $msg
   251 } {1 ENAMETOOLONG}
   252 test winFCmd-1.23 {TclpRenameFile: move dir into self} {pcOnly} {
   253     cleanup
   254     file mkdir td1
   255     list [catch {testfile mv [pwd]/td1 td1/td2} msg] $msg
   256 } {1 EINVAL}
   257 test winFCmd-1.24 {TclpRenameFile: move a root dir} {pcOnly} {
   258     cleanup
   259     list [catch {testfile mv / c:/} msg] $msg
   260 } {1 EINVAL}
   261 test winFCmd-1.25 {TclpRenameFile: cross file systems} {pcOnly cdrom} {
   262     cleanup
   263     file mkdir td1
   264     list [catch {testfile mv td1 $cdrom/td1} msg] $msg
   265 } {1 EXDEV} 
   266 test winFCmd-1.26 {TclpRenameFile: readonly fs} {pcOnly cdrom} {
   267     cleanup
   268     list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
   269 } {1 EACCES}
   270 test winFCmd-1.27 {TclpRenameFile: open file} {pcOnly} {
   271     cleanup
   272     set fd [open tf1 w]
   273     set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
   274     close $fd
   275     set msg
   276 } {1 EACCES}    
   277 test winFCmd-1.28 {TclpRenameFile: errno == EEXIST} {pcOnly} {
   278     cleanup
   279     createfile tf1
   280     createfile tf2
   281     testfile mv tf1 tf2
   282     list [file exists tf1] [file exists tf2]
   283 } {0 1}
   284 test winFCmd-1.29 {TclpRenameFile: src is dir} {pcOnly} {
   285     cleanup
   286     file mkdir td1
   287     createfile tf1
   288     list [catch {testfile mv td1 tf1} msg] $msg
   289 } {1 ENOTDIR} 
   290 test winFCmd-1.30 {TclpRenameFile: dst is dir} {pcOnly} {
   291     cleanup
   292     file mkdir td1
   293     file mkdir td2/td2
   294     list [catch {testfile mv td1 td2} msg] $msg
   295 } {1 EEXIST}
   296 test winFCmd-1.31 {TclpRenameFile: TclpRemoveDirectory fails} {pcOnly} {
   297     cleanup
   298     file mkdir td1
   299     file mkdir td2/td2
   300     list [catch {testfile mv td1 td2} msg] $msg
   301 } {1 EEXIST}
   302 test winFCmd-1.32 {TclpRenameFile: TclpRemoveDirectory succeeds} {pcOnly} {
   303     cleanup
   304     file mkdir td1/td2
   305     file mkdir td2
   306     testfile mv td1 td2
   307     list [file exists td1] [file exists td2] [file exists td2/td2]
   308 } {0 1 1}
   309 test winFCmd-1.33 {TclpRenameFile: After removing dst dir, MoveFile fails} \
   310 	{pcOnly exdev} {
   311     file mkdir d:/td1
   312     testchmod 000 d:/td1
   313     file mkdir c:/tf1
   314     set msg [list [catch {testfile mv c:/tf1 d:/td1} msg] $msg]
   315     set msg "$msg [file writable d:/td1]"
   316     file delete d:/td1
   317     file delete -force c:/tf1
   318     set msg
   319 } {1 EXDEV 0}
   320 test winFCmd-1.34 {TclpRenameFile: src is dir, dst is not} {pcOnly} {
   321     file mkdir td1
   322     createfile tf1
   323     list [catch {testfile mv td1 tf1} msg] $msg
   324 } {1 ENOTDIR}
   325 test winFCmd-1.35 {TclpRenameFile: src is not dir, dst is} {pcOnly} {
   326     file mkdir td1
   327     createfile tf1
   328     list [catch {testfile mv tf1 td1} msg] $msg
   329 } {1 EISDIR}
   330 test winFCmd-1.36 {TclpRenameFile: src and dst not dir} {pcOnly} {
   331     createfile tf1 tf1
   332     createfile tf2 tf2
   333     testfile mv tf1 tf2
   334     contents tf2
   335 } {tf1}
   336 test winFCmd-1.37 {TclpRenameFile: need to restore temp file} {pcOnly} {
   337     # Can't figure out how to cause this. 
   338     # Need a file that can't be copied.
   339 } {}
   340 
   341 test winFCmd-2.1 {TclpCopyFile: errno: EACCES} {pcOnly cdrom} {
   342     cleanup
   343     list [catch {testfile cp $cdfile $cdrom/dummy~~.fil} msg] $msg
   344 } {1 EACCES}
   345 test winFCmd-2.2 {TclpCopyFile: errno: EISDIR} {pcOnly} {
   346     cleanup
   347     file mkdir td1
   348     list [catch {testfile cp td1 tf1} msg] $msg
   349 } {1 EISDIR}
   350 test winFCmd-2.3 {TclpCopyFile: errno: EISDIR} {pcOnly} {
   351     cleanup
   352     createfile tf1
   353     file mkdir td1
   354     list [catch {testfile cp tf1 td1} msg] $msg
   355 } {1 EISDIR}
   356 test winFCmd-2.4 {TclpCopyFile: errno: ENOENT} {pcOnly} {
   357     cleanup
   358     list [catch {testfile cp tf1 tf2} msg] $msg
   359 } {1 ENOENT}
   360 test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} {pcOnly} {
   361     cleanup
   362     list [catch {testfile cp "" tf2} msg] $msg
   363 } {1 ENOENT}
   364 test winFCmd-2.6 {TclpCopyFile: errno: ENOENT} {pcOnly} {
   365     cleanup
   366     createfile tf1
   367     list [catch {testfile cp tf1 ""} msg] $msg
   368 } {1 ENOENT}
   369 test winFCmd-2.7 {TclpCopyFile: errno: EACCES} {pcOnly 95} {
   370     cleanup
   371     createfile tf1
   372     set fd [open tf2 w]
   373     set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
   374     close $fd
   375     set msg
   376 } {1 EACCES}
   377 test winFCmd-2.8 {TclpCopyFile: errno: EACCES} {pcOnly win2000orXP} {
   378     cleanup
   379     list [catch {testfile cp nul tf1} msg] $msg
   380 } {1 EINVAL}
   381 test winFCmd-2.8.1 {TclpCopyFile: errno: EACCES} {pcOnly nt winOlderThan2000} {
   382     cleanup
   383     list [catch {testfile cp nul tf1} msg] $msg
   384 } {1 EACCES}
   385 test winFCmd-2.9 {TclpCopyFile: errno: ENOENT} {pcOnly 95} {
   386     cleanup
   387     list [catch {testfile cp nul tf1} msg] $msg
   388 } {1 ENOENT}
   389 test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
   390     cleanup
   391     createfile tf1 tf1
   392     testfile cp tf1 tf2
   393     list [contents tf1] [contents tf2]
   394 } {tf1 tf1}
   395 test winFCmd-2.11 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
   396     cleanup
   397     createfile tf1 tf1
   398     createfile tf2 tf2
   399     testfile cp tf1 tf2
   400     list [contents tf1] [contents tf2]
   401 } {tf1 tf1}
   402 test winFCmd-2.12 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
   403     cleanup
   404     createfile tf1 tf1
   405     testchmod 000 tf1
   406     testfile cp tf1 tf2
   407     list [contents tf2] [file writable tf2]
   408 } {tf1 0}
   409 test winFCmd-2.13 {TclpCopyFile: CopyFile fails} {pcOnly} {
   410     cleanup
   411     createfile tf1
   412     file mkdir td1
   413     list [catch {testfile cp tf1 td1} msg] $msg
   414 } {1 EISDIR} 
   415 test winFCmd-2.14 {TclpCopyFile: errno == EACCES} {pcOnly} {
   416     cleanup
   417     file mkdir td1
   418     list [catch {testfile cp td1 tf1} msg] $msg
   419 } {1 EISDIR}
   420 test winFCmd-2.15 {TclpCopyFile: src is directory} {pcOnly} {
   421     cleanup
   422     file mkdir td1
   423     list [catch {testfile cp td1 tf1} msg] $msg
   424 } {1 EISDIR}
   425 test winFCmd-2.16 {TclpCopyFile: dst is directory} {pcOnly} {
   426     cleanup
   427     createfile tf1
   428     file mkdir td1
   429     list [catch {testfile cp tf1 td1} msg] $msg
   430 } {1 EISDIR}
   431 test winFCmd-2.17 {TclpCopyFile: dst is readonly} {pcOnly} {
   432     cleanup
   433     createfile tf1 tf1
   434     createfile tf2 tf2
   435     testchmod 000 tf2
   436     testfile cp tf1 tf2
   437     list [file writable tf2] [contents tf2]
   438 } {1 tf1}
   439 test winFCmd-2.18 {TclpCopyFile: still can't copy onto dst} {pcOnly 95} {
   440     cleanup
   441     createfile tf1
   442     createfile tf2
   443     testchmod 000 tf2
   444     set fd [open tf2]
   445     set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
   446     close $fd
   447     set msg "$msg [file writable tf2]"
   448 } {1 EACCES 0}    
   449 
   450 test winFCmd-3.1 {TclpDeleteFile: errno: EACCES} {pcOnly cdrom} {
   451     list [catch {testfile rm $cdfile $cdrom/dummy~~.fil} msg] $msg
   452 } {1 EACCES}
   453 test winFCmd-3.2 {TclpDeleteFile: errno: EISDIR} {pcOnly} {
   454     cleanup
   455     file mkdir td1
   456     list [catch {testfile rm td1} msg] $msg
   457 } {1 EISDIR} 
   458 test winFCmd-3.3 {TclpDeleteFile: errno: ENOENT} {pcOnly} {
   459     cleanup
   460     list [catch {testfile rm tf1} msg] $msg
   461 } {1 ENOENT}
   462 test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} {pcOnly} {
   463     cleanup
   464     list [catch {testfile rm ""} msg] $msg
   465 } {1 ENOENT}
   466 test winFCmd-3.5 {TclpDeleteFile: errno: EACCES} {pcOnly} {
   467     cleanup
   468     set fd [open tf1 w]
   469     set msg [list [catch {testfile rm tf1} msg] $msg]
   470     close $fd
   471     set msg
   472 } {1 EACCES}
   473 test winFCmd-3.6 {TclpDeleteFile: errno: EACCES} {pcOnly} {
   474     cleanup
   475     list [catch {testfile rm nul} msg] $msg
   476 } {1 EACCES}
   477 test winFCmd-3.7 {TclpDeleteFile: DeleteFile succeeds} {pcOnly} {
   478     cleanup
   479     createfile tf1
   480     testfile rm tf1
   481     file exists tf1
   482 } {0}
   483 test winFCmd-3.8 {TclpDeleteFile: DeleteFile fails} {pcOnly} {
   484     cleanup
   485     file mkdir td1
   486     list [catch {testfile rm td1} msg] $msg
   487 } {1 EISDIR}
   488 test winFCmd-3.9 {TclpDeleteFile: errno == EACCES} {pcOnly} {
   489     cleanup
   490     set fd [open tf1 w]
   491     set msg [list [catch {testfile rm tf1} msg] $msg]
   492     close $fd
   493     set msg
   494 } {1 EACCES}
   495 test winFCmd-3.10 {TclpDeleteFile: path is readonly} {pcOnly} {
   496     cleanup
   497     createfile tf1
   498     testchmod 000 tf1
   499     testfile rm tf1
   500     file exists tf1
   501 } {0}
   502 test winFCmd-3.11 {TclpDeleteFile: still can't remove path} {pcOnly} {
   503     cleanup
   504     set fd [open tf1 w]
   505     testchmod 000 tf1
   506     set msg [list [catch {testfile rm tf1} msg] $msg]
   507     close $fd
   508     set msg
   509 } {1 EACCES}
   510 
   511 test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} {pcOnly nt cdrom} {
   512     list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
   513 } {1 EACCES}
   514 test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} {pcOnly 95 cdrom} {
   515     list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
   516 } {1 ENOSPC}
   517 test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} {pcOnly} {
   518     cleanup
   519     file mkdir td1
   520     list [catch {testfile mkdir td1} msg] $msg
   521 } {1 EEXIST}
   522 test winFCmd-4.4 {TclpCreateDirectory: errno: ENOENT} {pcOnly} {
   523     cleanup
   524     list [catch {testfile mkdir td1/td2} msg] $msg
   525 } {1 ENOENT}
   526 test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} {pcOnly} {
   527     cleanup
   528     testfile mkdir td1
   529     file type td1
   530 } {directory}
   531 
   532 test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} {pcOnly} {
   533     cleanup
   534     file mkdir td1
   535     testfile cpdir td1 td2
   536     list [file type td1] [file type td2]
   537 } {directory directory}
   538 
   539 test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} {pcOnly} {
   540     cleanup
   541     file mkdir td1
   542     testchmod 000 td1
   543     testfile rmdir td1
   544     file exists td1
   545 } {0}
   546 test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} {pcOnly} {
   547     cleanup
   548     file mkdir td1/td2
   549     list [catch {testfile rmdir td1} msg] [file tail $msg]
   550 } {1 {td1 EEXIST}}
   551 test winFCmd-6.3 {TclpRemoveDirectory: errno: EACCES} {pcOnly} {
   552     # can't test this w/o removing everything on your hard disk first!
   553     # testfile rmdir /
   554 } {}
   555 test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} {
   556     cleanup
   557     list [catch {testfile rmdir td1} msg] [file tail $msg]
   558 } {1 {td1 ENOENT}}
   559 test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} {
   560     cleanup
   561     list [catch {testfile rmdir ""} msg] $msg
   562 } {1 ENOENT}
   563 test winFCmd-6.6 {TclpRemoveDirectory: errno: ENOTDIR} {pcOnly} {
   564     cleanup
   565     createfile tf1
   566     list [catch {testfile rmdir tf1} msg] [file tail $msg]
   567 } {1 {tf1 ENOTDIR}}
   568 test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} {pcOnly} {
   569     cleanup
   570     file mkdir td1
   571     testfile rmdir td1
   572     file exists td1
   573 } {0}
   574 test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} {pcOnly} {
   575     cleanup
   576     createfile tf1
   577     list [catch {testfile rmdir tf1} msg] [file tail $msg]
   578 } {1 {tf1 ENOTDIR}}
   579 test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} {pcOnly} {
   580     cleanup
   581     file mkdir td1
   582     testchmod 000 td1
   583     testfile rmdir td1
   584     file exists td1
   585 } {0}
   586 test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} {pcOnly 95} {
   587     cleanup
   588     list [catch {testfile rmdir nul} msg] $msg
   589 } {1 {nul EACCES}}
   590 test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} {pcOnly nt} {
   591     cleanup
   592     set res [list [catch {testfile rmdir /} msg] $msg]
   593     # WinXP returns EEXIST, WinNT seems to return EACCES.  No policy
   594     # decision has been made as to which is correct.
   595     regsub {E(ACCES|EXIST)} $res "EACCES or EEXIST" res
   596     # Don't mind which drive we're on
   597     regsub {[A-Z]:} $res ""
   598 } {1 {/ EACCES or EEXIST}}
   599 test winFCmd-6.12 {TclpRemoveDirectory: errno == EACCES} {pcOnly 95} {
   600     cleanup
   601     createfile tf1
   602     list [catch {testfile rmdir tf1} msg] $msg
   603 } {1 {tf1 ENOTDIR}}
   604 test winFCmd-6.13 {TclpRemoveDirectory: write-protected} {pcOnly} {
   605     cleanup
   606     file mkdir td1
   607     testchmod 000 td1
   608     testfile rmdir td1
   609     file exists td1
   610 } {0}
   611 test winFCmd-6.14 {TclpRemoveDirectory: check if empty dir} {pcOnly 95} {
   612     cleanup
   613     file mkdir td1/td2
   614     list [catch {testfile rmdir td1} msg] $msg
   615 } {1 {td1 EEXIST}}
   616 test winFCmd-6.15 {TclpRemoveDirectory: !recursive} {pcOnly} {
   617     cleanup
   618     file mkdir td1/td2
   619     list [catch {testfile rmdir td1} msg] [file tail $msg]
   620 } {1 {td1 EEXIST}}
   621 test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} {pcOnly} {
   622     cleanup
   623     createfile tf1
   624     list [catch {testfile rmdir -force tf1} msg] $msg
   625 } {1 {tf1 ENOTDIR}}
   626 test winFCmd-6.17 {TclpRemoveDirectory: calls TraverseWinTree} {pcOnly} {
   627     cleanup
   628     file mkdir td1/td2
   629     testfile rmdir -force td1
   630     file exists td1
   631 } {0}
   632 
   633 test winFCmd-7.1 {TraverseWinTree: targetPtr == NULL} {pcOnly} {
   634     cleanup
   635     file mkdir td1/td2/td3
   636     testfile rmdir -force td1
   637     file exists td1
   638 } {0}
   639 test winFCmd-7.2 {TraverseWinTree: targetPtr != NULL} {pcOnly} {
   640     cleanup
   641     file mkdir td1/td2/td3
   642     testfile cpdir td1 td2
   643     list [file exists td1] [file exists td2]
   644 } {1 1}
   645 test winFCmd-7.3 {TraverseWinTree: sourceAttr == -1} {pcOnly} {
   646     cleanup
   647     list [catch {testfile cpdir td1 td2} msg] $msg
   648 } {1 {td1 ENOENT}}
   649 test winFCmd-7.4 {TraverseWinTree: source isn't directory} {pcOnly} {
   650     cleanup
   651     file mkdir td1
   652     createfile td1/tf1 tf1
   653     testfile cpdir td1 td2
   654     contents td2/tf1
   655 } {tf1}
   656 test winFCmd-7.5 {TraverseWinTree: call TraversalCopy: DOTREE_F} {pcOnly} {
   657     cleanup
   658     file mkdir td1
   659     createfile td1/tf1 tf1
   660     testfile cpdir td1 td2
   661     contents td2/tf1
   662 } {tf1}
   663 test winFCmd-7.6 {TraverseWinTree: call TraversalDelete: DOTREE_F} {pcOnly} {
   664     cleanup
   665     file mkdir td1
   666     createfile td1/tf1 tf1
   667     testfile rmdir -force td1
   668     file exists td1
   669 } {0}
   670 test winFCmd-7.7 {TraverseWinTree: append \ to source if necessary} {pcOnly} {
   671     cleanup
   672     file mkdir td1
   673     createfile td1/tf1 tf1
   674     testfile cpdir td1 td2
   675     contents td2/tf1
   676 } {tf1}    
   677 test winFCmd-7.8 {TraverseWinTree: append \ to source if necessary} {pcOnly 95 cdrom} {
   678     # cdrom can return either d:\ or D:/, but we only care about the errcode
   679     list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1]
   680 } {1 EEXIST}
   681 test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {pcOnly nt cdrom} {
   682     list [catch {testfile rmdir $cdrom/} msg]  [lindex $msg 1]
   683 } {1 EACCES}
   684 test winFCmd-7.10 {TraverseWinTree: can't read directory: handle == INVALID} \
   685 	{pcOnly} {
   686     # can't make it happen
   687 } {}
   688 test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} {pcOnly} {
   689     cleanup
   690     file mkdir td1
   691     createfile td1/tf1 tf1
   692     testchmod 000 td1
   693     testfile cpdir td1 td2
   694     list [file exists td2] [file writable td2]
   695 } {1 1}
   696 test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} {pcOnly} {
   697     cleanup
   698     file mkdir td1
   699     createfile td1/tf1 tf1
   700     testfile rmdir -force td1
   701     file exists td1
   702 } {0}
   703 test winFCmd-7.13 {TraverseWinTree: append \ to target if necessary} {pcOnly} {
   704     cleanup
   705     file mkdir td1
   706     createfile td1/tf1 tf1
   707     testfile cpdir td1 td2
   708     contents td2/tf1
   709 } {tf1}    
   710 test winFCmd-7.14 {TraverseWinTree: append \ to target if necessary} {pcOnly 95} {
   711     cleanup
   712     file mkdir td1
   713     list [catch {testfile cpdir td1 /} msg] $msg
   714 } {1 {/ EEXIST}}
   715 test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {pcOnly nt} {
   716     cleanup
   717     file mkdir td1
   718     list [catch {testfile cpdir td1 /} msg] $msg
   719 } {1 {/ EACCES}}
   720 test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} {pcOnly} {
   721     cleanup
   722     file mkdir td1
   723     testfile cpdir td1 td2
   724 } {}
   725 test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} {pcOnly} {
   726     cleanup
   727     file mkdir td1
   728     createfile td1/td2
   729     testfile cpdir td1 td2
   730     glob td2/*
   731 } {td2/td2}
   732 test winFCmd-7.18 {TraverseWinTree: recurse on files: several files and dir} \
   733 	{pcOnly} {
   734     cleanup
   735     file mkdir td1
   736     createfile td1/tf1
   737     createfile td1/tf2
   738     file mkdir td1/td2/td3
   739     createfile td1/tf3
   740     createfile td1/tf4
   741     testfile cpdir td1 td2
   742     lsort [glob td2/*]
   743 } {td2/td2 td2/tf1 td2/tf2 td2/tf3 td2/tf4}
   744 test winFCmd-7.19 {TraverseWinTree: call TraversalCopy: DOTREE_POSTD} {pcOnly} {
   745     cleanup
   746     file mkdir td1
   747     createfile td1/tf1 tf1
   748     testchmod 000 td1
   749     testfile cpdir td1 td2
   750     list [file exists td2] [file writable td2]
   751 } {1 1}
   752 test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} \
   753 	{pcOnly} {
   754     cleanup
   755     file mkdir td1
   756     createfile td1/tf1 tf1
   757     testfile rmdir -force td1
   758     file exists td1
   759 } {0}
   760 test winFCmd-7.21 {TraverseWinTree: fill errorPtr} {pcOnly} {
   761     cleanup
   762     list [catch {testfile cpdir td1 td2} msg] $msg
   763 } {1 {td1 ENOENT}}
   764 
   765 test winFCmd-8.1 {TraversalCopy: DOTREE_F} {pcOnly} {
   766     cleanup
   767     file mkdir td1
   768     list [catch {testfile cpdir td1 td1} msg] $msg
   769 } {1 {td1 EEXIST}}
   770 test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} {pcOnly} {
   771     cleanup
   772     file mkdir td1/td2
   773     testchmod 000 td1
   774     testfile cpdir td1 td2
   775     list [file writable td1] [file writable td1/td2]
   776 } {0 1}
   777 test winFCmd-8.3 {TraversalCopy: DOTREE_POSTD} {pcOnly} {
   778     cleanup
   779     file mkdir td1
   780     testfile cpdir td1 td2
   781 } {}
   782 
   783 test winFCmd-9.1 {TraversalDelete: DOTREE_F} {pcOnly} {
   784     cleanup
   785     file mkdir td1
   786     createfile td1/tf1
   787     testfile rmdir -force td1
   788 } {}
   789 test winFCmd-9.2 {TraversalDelete: DOTREE_F} {pcOnly 95} {
   790     cleanup
   791     file mkdir td1
   792     set fd [open td1/tf1 w]
   793     set msg [list [catch {testfile rmdir -force td1} msg] $msg]
   794     close $fd
   795     set msg
   796 } {1 {td1\tf1 EACCES}}
   797 test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} {pcOnly} {
   798     cleanup
   799     file mkdir td1/td2
   800     testchmod 000 td1
   801     testfile rmdir -force td1
   802     file exists td1
   803 } {0}
   804 test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} {pcOnly} {
   805     cleanup
   806     file mkdir td1/td1/td3/td4/td5
   807     testfile rmdir -force td1
   808 } {}
   809 
   810 test winFCmd-10.1 {AttributesPosixError - get} {pcOnly} {
   811     cleanup
   812     list [catch {file attributes td1 -archive} msg] $msg
   813 } {1 {could not read "td1": no such file or directory}}
   814 test winFCmd-10.2 {AttributesPosixError - set} {pcOnly} {
   815     cleanup
   816     list [catch {file attributes td1 -archive 0} msg] $msg
   817 } {1 {could not read "td1": no such file or directory}}
   818 
   819 test winFCmd-11.1 {GetWinFileAttributes} {pcOnly} {
   820     cleanup
   821     close [open td1 w]
   822     list [catch {file attributes td1 -archive} msg] $msg [cleanup]
   823 } {0 1 {}}
   824 test winFCmd-11.2 {GetWinFileAttributes} {pcOnly} {
   825     cleanup
   826     close [open td1 w]
   827     list [catch {file attributes td1 -readonly} msg] $msg [cleanup]
   828 } {0 0 {}}
   829 test winFCmd-11.3 {GetWinFileAttributes} {pcOnly} {
   830     cleanup
   831     close [open td1 w]
   832     list [catch {file attributes td1 -hidden} msg] $msg [cleanup]
   833 } {0 0 {}}
   834 test winFCmd-11.4 {GetWinFileAttributes} {pcOnly} {
   835     cleanup
   836     close [open td1 w]
   837     list [catch {file attributes td1 -system} msg] $msg [cleanup]
   838 } {0 0 {}}
   839 test winFCmd-11.5 {GetWinFileAttributes} {pcOnly} {
   840     # attr of relative paths that resolve to root was failing
   841     # don't care about answer, just that test runs.
   842 
   843     set old [pwd]
   844     cd c:/
   845     file attr c:	    
   846     file attr c:.
   847     file attr . 
   848     cd $old
   849 } {}
   850 test winFCmd-11.6 {GetWinFileAttributes} {pcOnly} {
   851     file attr c:/ -hidden
   852 } {0}
   853 
   854 test winFCmd-12.1 {ConvertFileNameFormat} {pcOnly} {
   855     cleanup
   856     close [open td1 w]
   857     list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
   858 } {0 td1 {}}
   859 test winFCmd-12.2 {ConvertFileNameFormat} {pcOnly} {
   860     cleanup
   861     file mkdir td1
   862     close [open td1/td1 w]
   863     list [catch {string tolower [file attributes td1/td1 -longname]} msg] $msg [cleanup]
   864 } {0 td1/td1 {}}
   865 test winFCmd-12.3 {ConvertFileNameFormat} {pcOnly} {
   866     cleanup
   867     file mkdir td1
   868     file mkdir td1/td2
   869     close [open td1/td3 w]
   870     list [catch {string tolower [file attributes td1/td2/../td3 -longname]} msg] $msg [cleanup]
   871 } {0 td1/td2/../td3 {}}
   872 test winFCmd-12.4 {ConvertFileNameFormat} {pcOnly} {
   873     cleanup
   874     close [open td1 w]
   875     list [catch {string tolower [file attributes ./td1 -longname]} msg] $msg [cleanup]
   876 } {0 ./td1 {}}
   877 test winFCmd-12.5 {ConvertFileNameFormat: absolute path} {pcOnly} {
   878     list [file attributes / -longname] [file attributes \\ -longname]
   879 } {/ /}
   880 test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} {pcOnly} {
   881     catch {file delete -force -- c:/td1}
   882     close [open c:/td1 w]
   883     list [catch {string tolower [file attributes c:/td1 -longname]} msg] $msg [file delete -force -- c:/td1]
   884 } {0 c:/td1 {}}
   885 test winFCmd-12.7 {ConvertFileNameFormat} {nonPortable pcOnly} {
   886     string tolower [file attributes //bisque/tcl/ws -longname]
   887 } {//bisque/tcl/ws}
   888 test winFCmd-12.8 {ConvertFileNameFormat} {pcOnly longFileNames} {
   889     cleanup
   890     close [open td1 w]
   891     list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
   892 } {0 td1 {}}
   893 test winFCmd-12.10 {ConvertFileNameFormat} {longFileNames pcOnly} {
   894     cleanup
   895     close [open td1td1td1 w]
   896     list [catch {file attributes td1td1td1 -shortname}] [cleanup]
   897 } {0 {}}
   898 test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames pcOnly} {
   899     cleanup
   900     close [open td1 w]
   901     list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
   902 } {0 td1 {}}
   903 
   904 test winFCmd-13.1 {GetWinFileLongName} {pcOnly} {
   905     cleanup
   906     close [open td1 w]
   907     list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
   908 } {0 td1 {}}
   909 
   910 test winFCmd-14.1 {GetWinFileShortName} {pcOnly} {
   911     cleanup
   912     close [open td1 w]
   913     list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
   914 } {0 td1 {}}
   915 
   916 test winFCmd-15.1 {SetWinFileAttributes} {pcOnly} {
   917     cleanup
   918     list [catch {file attributes td1 -archive 0} msg] $msg
   919 } {1 {could not read "td1": no such file or directory}}
   920 test winFCmd-15.2 {SetWinFileAttributes - archive} {pcOnly} {
   921     cleanup
   922     close [open td1 w]
   923     list [catch {file attributes td1 -archive 1} msg] $msg [file attributes td1 -archive] [cleanup]
   924 } {0 {} 1 {}}
   925 test winFCmd-15.3 {SetWinFileAttributes - archive} {pcOnly} {
   926     cleanup
   927     close [open td1 w]
   928     list [catch {file attributes td1 -archive 0} msg] $msg [file attributes td1 -archive] [cleanup]
   929 } {0 {} 0 {}}
   930 test winFCmd-15.4 {SetWinFileAttributes - hidden} {pcOnly} {
   931     cleanup
   932     close [open td1 w]
   933     list [catch {file attributes td1 -hidden 1} msg] $msg [file attributes td1 -hidden] [file attributes td1 -hidden 0] [cleanup]
   934 } {0 {} 1 {} {}}
   935 test winFCmd-15.5 {SetWinFileAttributes - hidden} {pcOnly} {
   936     cleanup
   937     close [open td1 w]
   938     list [catch {file attributes td1 -hidden 0} msg] $msg [file attributes td1 -hidden] [cleanup]
   939 } {0 {} 0 {}}
   940 test winFCmd-15.6 {SetWinFileAttributes - readonly} {pcOnly} {
   941     cleanup
   942     close [open td1 w]
   943     list [catch {file attributes td1 -readonly 1} msg] $msg [file attributes td1 -readonly] [cleanup]
   944 } {0 {} 1 {}}
   945 test winFCmd-15.7 {SetWinFileAttributes - readonly} {pcOnly} {
   946     cleanup
   947     close [open td1 w]
   948     list [catch {file attributes td1 -readonly 0} msg] $msg [file attributes td1 -readonly] [cleanup]
   949 } {0 {} 0 {}}
   950 test winFCmd-15.8 {SetWinFileAttributes - system} {pcOnly} {
   951     cleanup
   952     close [open td1 w]
   953     list [catch {file attributes td1 -system 1} msg] $msg [file attributes td1 -system] [cleanup]
   954 } {0 {} 1 {}}
   955 test winFCmd-15.9 {SetWinFileAttributes - system} {pcOnly} {
   956     cleanup
   957     close [open td1 w]
   958     list [catch {file attributes td1 -system 0} msg] $msg [file attributes td1 -system] [cleanup]
   959 } {0 {} 0 {}}
   960 test winFCmd-15.10 {SetWinFileAttributes - failing} {pcOnly cdrom} {
   961     cleanup
   962     catch {file attributes $cdfile -archive 1}
   963 } {1}
   964 test winFCmd-16.1 {Windows file normalization} {pcOnly} {
   965     list [file normalize c:/] [file normalize C:/]
   966 } {C:/ C:/}
   967 test winFCmd-16.2 {Windows file normalization} {pcOnly} {
   968     close [open td1... w]
   969     set res [file tail [file normalize td1]]
   970     file delete td1...
   971     set res
   972 } {td1}
   973 
   974 set pwd [pwd]
   975 set d [string index $pwd 0]
   976 
   977 test winFCmd-16.3 {Windows file normalization} {pcOnly} {
   978     file norm ${d}:foo
   979 } [file join $pwd foo]
   980 test winFCmd-16.4 {Windows file normalization} {pcOnly} {
   981     file norm [string tolower ${d}]:foo
   982 } [file join $pwd foo]
   983 test winFCmd-16.5 {Windows file normalization} {pcOnly} {
   984     file norm ${d}:foo/bar
   985 } [file join $pwd foo/bar]
   986 test winFCmd-16.6 {Windows file normalization} {pcOnly} {
   987     file norm ${d}:foo\\bar
   988 } [file join $pwd foo/bar]
   989 test winFCmd-16.7 {Windows file normalization} {pcOnly} {
   990     file norm /bar
   991 } "${d}:/bar"
   992 test winFCmd-16.8 {Windows file normalization} {pcOnly} {
   993     file norm ///bar
   994 } "${d}:/bar"
   995 test winFCmd-16.9 {Windows file normalization} {pcOnly} {
   996     file norm /bar/foo
   997 } "${d}:/bar/foo"
   998 if {$d eq "C"} { set dd "D" } else { set dd "C" }
   999 test winFCmd-16.10 {Windows file normalization} {pcOnly} {
  1000     file norm ${dd}:foo
  1001 } "${dd}:/foo"
  1002 test winFCmd-16.11 {Windows file normalization} {pcOnly cdrom} {
  1003     cd ${d}:
  1004     cd $cdrom
  1005     cd ${d}:
  1006     cd $cdrom
  1007     # Must not crash
  1008     set result "no crash"
  1009 } {no crash}
  1010 test winFCmd-16.12 {Windows file normalization} {pcOnly} {
  1011     set oldhome ""
  1012     catch {set oldhome $::env(HOME)}
  1013     set ::env(HOME) ${d}:
  1014     cd
  1015     set result [pwd]; # <- Must not crash
  1016     set ::env(HOME) $oldhome
  1017     set result
  1018 } ${d}:/
  1019 
  1020 cd $pwd
  1021 unset d dd pwd
  1022 
  1023 test winFCmd-18.1 {Windows reserved path names} -constraints win -body {
  1024     file pathtype com1
  1025 } -result "absolute"
  1026 
  1027 test winFCmd-18.1.2 {Windows reserved path names} -constraints win -body {
  1028     file pathtype com4
  1029 } -result "absolute"
  1030 
  1031 test winFCmd-18.1.3 {Windows reserved path names} -constraints win -body {
  1032     file pathtype com5
  1033 } -result "relative"
  1034 
  1035 test winFCmd-18.1.4 {Windows reserved path names} -constraints win -body {
  1036     file pathtype lpt3
  1037 } -result "absolute"
  1038 
  1039 test winFCmd-18.1.5 {Windows reserved path names} -constraints win -body {
  1040     file pathtype lpt4
  1041 } -result "relative"
  1042 
  1043 test winFCmd-18.1.6 {Windows reserved path names} -constraints win -body {
  1044     file pathtype nul
  1045 } -result "absolute"
  1046 
  1047 test winFCmd-18.1.7 {Windows reserved path names} -constraints win -body {
  1048     file pathtype null
  1049 } -result "relative"
  1050 
  1051 test winFCmd-18.2 {Windows reserved path names} -constraints win -body {
  1052     file pathtype com1:
  1053 } -result "absolute"
  1054 
  1055 test winFCmd-18.3 {Windows reserved path names} -constraints win -body {
  1056     file pathtype COM1
  1057 } -result "absolute"
  1058 
  1059 test winFCmd-18.4 {Windows reserved path names} -constraints win -body {
  1060     file pathtype CoM1:
  1061 } -result "absolute"
  1062 
  1063 test winFCmd-18.5 {Windows reserved path names} -constraints win -body {
  1064     file normalize com1:
  1065 } -result COM1
  1066 
  1067 test winFCmd-18.6 {Windows reserved path names} -constraints win -body {
  1068     file normalize COM1:
  1069 } -result COM1
  1070 
  1071 test winFCmd-18.7 {Windows reserved path names} -constraints win -body {
  1072     file normalize cOm1
  1073 } -result COM1
  1074 
  1075 test winFCmd-18.8 {Windows reserved path names} -constraints win -body {
  1076     file normalize cOm1:
  1077 } -result COM1
  1078 
  1079 # This block of code used to occur after the "return" call, so I'm
  1080 # commenting it out and assuming that this code is still under construction.
  1081 #foreach source {tef ted tnf tnd "" nul com1} {
  1082 #    foreach chmodsrc {000 755} {
  1083 #        foreach dest "tfn tfe tdn tdempty tdfull td1/td2 $p $p/td1 {} nul" {
  1084 #	    foreach chmoddst {000 755} {
  1085 #		puts hi
  1086 #		cleanup
  1087 #		file delete -force ted tef
  1088 #		file mkdir ted
  1089 #		createfile tef
  1090 #		createfile tfe
  1091 #		file mkdir tdempty
  1092 #		file mkdir tdfull/td1/td2
  1093 #
  1094 #		catch {testchmod $chmodsrc $source}
  1095 #		catch {testchmod $chmoddst $dest}
  1096 #
  1097 #		if [catch {file rename $source $dest} msg] {
  1098 #		    puts "file rename $source ($chmodsrc) $dest ($chmoddst)"
  1099 #		    puts $msg
  1100 #		}
  1101 #	    }
  1102 #	}
  1103 #    }
  1104 #}
  1105 
  1106 # cleanup
  1107 cleanup
  1108 ::tcltest::cleanupTests
  1109 return