winFCmd.test
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:33k
源码类别:

通讯编程

开发平台:

Visual C++

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