os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winFCmd.test
First public contribution.
1 # This file tests the tclWinFCmd.c file.
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.
7 # Copyright (c) 1996-1997 Sun Microsystems, Inc.
8 # Copyright (c) 1998-1999 by Scriptics Corporation.
10 # See the file "license.terms" for information on usage and redistribution
11 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 # RCS: @(#) $Id: winFCmd.test,v 1.20.2.9 2006/03/19 22:47:30 vincentdarley Exp $
16 if {[lsearch [namespace children] ::tcltest] == -1} {
17 package require tcltest
18 namespace import -force ::tcltest::*
21 proc createfile {file {string a}} {
23 puts -nonewline $f $string
28 proc contents {file} {
39 set x [glob -directory $p tf* td*]
42 catch {eval file delete -force -- $x}
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
53 tcltest::testConstraint win2000orXP 0
54 tcltest::testConstraint winOlderThan2000 1
57 tcltest::testConstraint win2000orXP 0
58 tcltest::testConstraint winOlderThan2000 0
61 set ::tcltest::testConstraints(cdrom) 0
62 set ::tcltest::testConstraints(exdev) 0
64 # find a CD-ROM so we can test read-only filesystems.
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} } {
76 foreach p [glob $dir/*] {
77 if {[file type $p] == "file"} {
81 foreach p [glob $dir/*] {
82 if {[file type $p] == "directory"} {
93 set ::tcltest::testConstraints(cdrom) 1
94 set cdfile [findfile $cdrom]
97 if {[file exists c:/] && [file exists d:/]} {
98 catch {file delete d:/tf1}
99 if {[catch {close [open d:/tf1 w]}] == 0} {
101 set ::tcltest::testConstraints(exdev) 1
105 file delete -force -- td1
106 set foo [catch {open td1 w} testfile]
108 set ::tcltest::testConstraints(longFileNames) 0
111 set ::tcltest::testConstraints(longFileNames) 1
112 file delete -force -- td1
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.
119 set longname "abcdefghihjllmnopqrstuvwxyz01234567890"
120 append longname $longname
121 append longname $longname
122 append longname $longname
123 append longname $longname
124 append longname $longname
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.
131 test winFCmd-1.1 {TclpRenameFile: errno: EACCES} {pcOnly cdrom} {
132 list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
134 test winFCmd-1.2 {TclpRenameFile: errno: EEXIST} {pcOnly} {
136 file mkdir td1/td2/td3
138 list [catch {testfile mv td2 td1/td2} msg] $msg
140 test winFCmd-1.3 {TclpRenameFile: errno: EINVAL} {pcOnly} {
142 list [catch {testfile mv / td1} msg] $msg
144 test winFCmd-1.4 {TclpRenameFile: errno: EINVAL} {pcOnly} {
147 list [catch {testfile mv td1 td1/td2} msg] $msg
149 test winFCmd-1.5 {TclpRenameFile: errno: EISDIR} {pcOnly} {
153 list [catch {testfile mv tf1 td1} msg] $msg
155 test winFCmd-1.6 {TclpRenameFile: errno: ENOENT} {pcOnly} {
157 list [catch {testfile mv tf1 tf2} msg] $msg
159 test winFCmd-1.7 {TclpRenameFile: errno: ENOENT} {pcOnly} {
161 list [catch {testfile mv "" tf2} msg] $msg
163 test winFCmd-1.8 {TclpRenameFile: errno: ENOENT} {pcOnly} {
166 list [catch {testfile mv tf1 ""} msg] $msg
168 test winFCmd-1.9 {TclpRenameFile: errno: ENOTDIR} {pcOnly} {
172 list [catch {testfile mv td1 tf1} msg] $msg
174 test winFCmd-1.10 {TclpRenameFile: errno: EXDEV} {pcOnly exdev} {
175 file delete -force d:/tf1
177 set msg [list [catch {testfile mv c:/tf1 d:/tf1} msg] $msg]
178 file delete -force c:/tf1
181 test winFCmd-1.11 {TclpRenameFile: errno: EACCES} {pcOnly} {
184 set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
188 test winFCmd-1.12 {TclpRenameFile: errno: EACCES} {pcOnly} {
192 set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
196 test winFCmd-1.13 {TclpRenameFile: errno: EACCES} {pcOnly win2000orXP} {
198 list [catch {testfile mv nul tf1} msg] $msg
200 test winFCmd-1.13.1 {TclpRenameFile: errno: EACCES} {pcOnly winOlderThan2000} {
202 list [catch {testfile mv nul tf1} msg] $msg
204 test winFCmd-1.14 {TclpRenameFile: errno: EACCES} {pcOnly 95} {
207 list [catch {testfile mv tf1 nul} msg] $msg
209 test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} {pcOnly nt} {
212 list [catch {testfile mv tf1 nul} msg] $msg
214 test winFCmd-1.16 {TclpRenameFile: MoveFile() != FALSE} {pcOnly} {
218 list [file exists tf1] [contents tf2]
220 test winFCmd-1.17 {TclpRenameFile: MoveFile() == FALSE} {pcOnly} {
222 list [catch {testfile mv tf1 tf2} msg] $msg
224 test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} {pcOnly} {
226 list [catch {testfile mv tf1 tf2} msg] $msg
228 test winFCmd-1.19 {TclpRenameFile: errno == EACCES} {pcOnly win2000orXP} {
230 list [catch {testfile mv nul tf1} msg] $msg
232 test winFCmd-1.19.1 {TclpRenameFile: errno == EACCES} {pcOnly winOlderThan2000} {
234 list [catch {testfile mv nul tf1} msg] $msg
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!
241 list [catch {testfile mv [pwd] /tf1} msg] $msg
243 test winFCmd-1.21 {TclpRenameFile: long src} {pcOnly} {
245 list [catch {testfile mv $longname tf1} msg] $msg
247 test winFCmd-1.22 {TclpRenameFile: long dst} {pcOnly} {
250 list [catch {testfile mv tf1 $longname} msg] $msg
252 test winFCmd-1.23 {TclpRenameFile: move dir into self} {pcOnly} {
255 list [catch {testfile mv [pwd]/td1 td1/td2} msg] $msg
257 test winFCmd-1.24 {TclpRenameFile: move a root dir} {pcOnly} {
259 list [catch {testfile mv / c:/} msg] $msg
261 test winFCmd-1.25 {TclpRenameFile: cross file systems} {pcOnly cdrom} {
264 list [catch {testfile mv td1 $cdrom/td1} msg] $msg
266 test winFCmd-1.26 {TclpRenameFile: readonly fs} {pcOnly cdrom} {
268 list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
270 test winFCmd-1.27 {TclpRenameFile: open file} {pcOnly} {
273 set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
277 test winFCmd-1.28 {TclpRenameFile: errno == EEXIST} {pcOnly} {
282 list [file exists tf1] [file exists tf2]
284 test winFCmd-1.29 {TclpRenameFile: src is dir} {pcOnly} {
288 list [catch {testfile mv td1 tf1} msg] $msg
290 test winFCmd-1.30 {TclpRenameFile: dst is dir} {pcOnly} {
294 list [catch {testfile mv td1 td2} msg] $msg
296 test winFCmd-1.31 {TclpRenameFile: TclpRemoveDirectory fails} {pcOnly} {
300 list [catch {testfile mv td1 td2} msg] $msg
302 test winFCmd-1.32 {TclpRenameFile: TclpRemoveDirectory succeeds} {pcOnly} {
307 list [file exists td1] [file exists td2] [file exists td2/td2]
309 test winFCmd-1.33 {TclpRenameFile: After removing dst dir, MoveFile fails} \
314 set msg [list [catch {testfile mv c:/tf1 d:/td1} msg] $msg]
315 set msg "$msg [file writable d:/td1]"
317 file delete -force c:/tf1
320 test winFCmd-1.34 {TclpRenameFile: src is dir, dst is not} {pcOnly} {
323 list [catch {testfile mv td1 tf1} msg] $msg
325 test winFCmd-1.35 {TclpRenameFile: src is not dir, dst is} {pcOnly} {
328 list [catch {testfile mv tf1 td1} msg] $msg
330 test winFCmd-1.36 {TclpRenameFile: src and dst not dir} {pcOnly} {
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.
341 test winFCmd-2.1 {TclpCopyFile: errno: EACCES} {pcOnly cdrom} {
343 list [catch {testfile cp $cdfile $cdrom/dummy~~.fil} msg] $msg
345 test winFCmd-2.2 {TclpCopyFile: errno: EISDIR} {pcOnly} {
348 list [catch {testfile cp td1 tf1} msg] $msg
350 test winFCmd-2.3 {TclpCopyFile: errno: EISDIR} {pcOnly} {
354 list [catch {testfile cp tf1 td1} msg] $msg
356 test winFCmd-2.4 {TclpCopyFile: errno: ENOENT} {pcOnly} {
358 list [catch {testfile cp tf1 tf2} msg] $msg
360 test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} {pcOnly} {
362 list [catch {testfile cp "" tf2} msg] $msg
364 test winFCmd-2.6 {TclpCopyFile: errno: ENOENT} {pcOnly} {
367 list [catch {testfile cp tf1 ""} msg] $msg
369 test winFCmd-2.7 {TclpCopyFile: errno: EACCES} {pcOnly 95} {
373 set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
377 test winFCmd-2.8 {TclpCopyFile: errno: EACCES} {pcOnly win2000orXP} {
379 list [catch {testfile cp nul tf1} msg] $msg
381 test winFCmd-2.8.1 {TclpCopyFile: errno: EACCES} {pcOnly nt winOlderThan2000} {
383 list [catch {testfile cp nul tf1} msg] $msg
385 test winFCmd-2.9 {TclpCopyFile: errno: ENOENT} {pcOnly 95} {
387 list [catch {testfile cp nul tf1} msg] $msg
389 test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
393 list [contents tf1] [contents tf2]
395 test winFCmd-2.11 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
400 list [contents tf1] [contents tf2]
402 test winFCmd-2.12 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
407 list [contents tf2] [file writable tf2]
409 test winFCmd-2.13 {TclpCopyFile: CopyFile fails} {pcOnly} {
413 list [catch {testfile cp tf1 td1} msg] $msg
415 test winFCmd-2.14 {TclpCopyFile: errno == EACCES} {pcOnly} {
418 list [catch {testfile cp td1 tf1} msg] $msg
420 test winFCmd-2.15 {TclpCopyFile: src is directory} {pcOnly} {
423 list [catch {testfile cp td1 tf1} msg] $msg
425 test winFCmd-2.16 {TclpCopyFile: dst is directory} {pcOnly} {
429 list [catch {testfile cp tf1 td1} msg] $msg
431 test winFCmd-2.17 {TclpCopyFile: dst is readonly} {pcOnly} {
437 list [file writable tf2] [contents tf2]
439 test winFCmd-2.18 {TclpCopyFile: still can't copy onto dst} {pcOnly 95} {
445 set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
447 set msg "$msg [file writable tf2]"
450 test winFCmd-3.1 {TclpDeleteFile: errno: EACCES} {pcOnly cdrom} {
451 list [catch {testfile rm $cdfile $cdrom/dummy~~.fil} msg] $msg
453 test winFCmd-3.2 {TclpDeleteFile: errno: EISDIR} {pcOnly} {
456 list [catch {testfile rm td1} msg] $msg
458 test winFCmd-3.3 {TclpDeleteFile: errno: ENOENT} {pcOnly} {
460 list [catch {testfile rm tf1} msg] $msg
462 test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} {pcOnly} {
464 list [catch {testfile rm ""} msg] $msg
466 test winFCmd-3.5 {TclpDeleteFile: errno: EACCES} {pcOnly} {
469 set msg [list [catch {testfile rm tf1} msg] $msg]
473 test winFCmd-3.6 {TclpDeleteFile: errno: EACCES} {pcOnly} {
475 list [catch {testfile rm nul} msg] $msg
477 test winFCmd-3.7 {TclpDeleteFile: DeleteFile succeeds} {pcOnly} {
483 test winFCmd-3.8 {TclpDeleteFile: DeleteFile fails} {pcOnly} {
486 list [catch {testfile rm td1} msg] $msg
488 test winFCmd-3.9 {TclpDeleteFile: errno == EACCES} {pcOnly} {
491 set msg [list [catch {testfile rm tf1} msg] $msg]
495 test winFCmd-3.10 {TclpDeleteFile: path is readonly} {pcOnly} {
502 test winFCmd-3.11 {TclpDeleteFile: still can't remove path} {pcOnly} {
506 set msg [list [catch {testfile rm tf1} msg] $msg]
511 test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} {pcOnly nt cdrom} {
512 list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
514 test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} {pcOnly 95 cdrom} {
515 list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
517 test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} {pcOnly} {
520 list [catch {testfile mkdir td1} msg] $msg
522 test winFCmd-4.4 {TclpCreateDirectory: errno: ENOENT} {pcOnly} {
524 list [catch {testfile mkdir td1/td2} msg] $msg
526 test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} {pcOnly} {
532 test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} {pcOnly} {
535 testfile cpdir td1 td2
536 list [file type td1] [file type td2]
537 } {directory directory}
539 test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} {pcOnly} {
546 test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} {pcOnly} {
549 list [catch {testfile rmdir td1} msg] [file tail $msg]
551 test winFCmd-6.3 {TclpRemoveDirectory: errno: EACCES} {pcOnly} {
552 # can't test this w/o removing everything on your hard disk first!
555 test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} {
557 list [catch {testfile rmdir td1} msg] [file tail $msg]
559 test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} {
561 list [catch {testfile rmdir ""} msg] $msg
563 test winFCmd-6.6 {TclpRemoveDirectory: errno: ENOTDIR} {pcOnly} {
566 list [catch {testfile rmdir tf1} msg] [file tail $msg]
568 test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} {pcOnly} {
574 test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} {pcOnly} {
577 list [catch {testfile rmdir tf1} msg] [file tail $msg]
579 test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} {pcOnly} {
586 test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} {pcOnly 95} {
588 list [catch {testfile rmdir nul} msg] $msg
590 test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} {pcOnly nt} {
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} {
602 list [catch {testfile rmdir tf1} msg] $msg
604 test winFCmd-6.13 {TclpRemoveDirectory: write-protected} {pcOnly} {
611 test winFCmd-6.14 {TclpRemoveDirectory: check if empty dir} {pcOnly 95} {
614 list [catch {testfile rmdir td1} msg] $msg
616 test winFCmd-6.15 {TclpRemoveDirectory: !recursive} {pcOnly} {
619 list [catch {testfile rmdir td1} msg] [file tail $msg]
621 test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} {pcOnly} {
624 list [catch {testfile rmdir -force tf1} msg] $msg
626 test winFCmd-6.17 {TclpRemoveDirectory: calls TraverseWinTree} {pcOnly} {
629 testfile rmdir -force td1
633 test winFCmd-7.1 {TraverseWinTree: targetPtr == NULL} {pcOnly} {
635 file mkdir td1/td2/td3
636 testfile rmdir -force td1
639 test winFCmd-7.2 {TraverseWinTree: targetPtr != NULL} {pcOnly} {
641 file mkdir td1/td2/td3
642 testfile cpdir td1 td2
643 list [file exists td1] [file exists td2]
645 test winFCmd-7.3 {TraverseWinTree: sourceAttr == -1} {pcOnly} {
647 list [catch {testfile cpdir td1 td2} msg] $msg
649 test winFCmd-7.4 {TraverseWinTree: source isn't directory} {pcOnly} {
652 createfile td1/tf1 tf1
653 testfile cpdir td1 td2
656 test winFCmd-7.5 {TraverseWinTree: call TraversalCopy: DOTREE_F} {pcOnly} {
659 createfile td1/tf1 tf1
660 testfile cpdir td1 td2
663 test winFCmd-7.6 {TraverseWinTree: call TraversalDelete: DOTREE_F} {pcOnly} {
666 createfile td1/tf1 tf1
667 testfile rmdir -force td1
670 test winFCmd-7.7 {TraverseWinTree: append \ to source if necessary} {pcOnly} {
673 createfile td1/tf1 tf1
674 testfile cpdir td1 td2
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]
681 test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {pcOnly nt cdrom} {
682 list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1]
684 test winFCmd-7.10 {TraverseWinTree: can't read directory: handle == INVALID} \
686 # can't make it happen
688 test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} {pcOnly} {
691 createfile td1/tf1 tf1
693 testfile cpdir td1 td2
694 list [file exists td2] [file writable td2]
696 test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} {pcOnly} {
699 createfile td1/tf1 tf1
700 testfile rmdir -force td1
703 test winFCmd-7.13 {TraverseWinTree: append \ to target if necessary} {pcOnly} {
706 createfile td1/tf1 tf1
707 testfile cpdir td1 td2
710 test winFCmd-7.14 {TraverseWinTree: append \ to target if necessary} {pcOnly 95} {
713 list [catch {testfile cpdir td1 /} msg] $msg
715 test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {pcOnly nt} {
718 list [catch {testfile cpdir td1 /} msg] $msg
720 test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} {pcOnly} {
723 testfile cpdir td1 td2
725 test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} {pcOnly} {
729 testfile cpdir td1 td2
732 test winFCmd-7.18 {TraverseWinTree: recurse on files: several files and dir} \
738 file mkdir td1/td2/td3
741 testfile cpdir td1 td2
743 } {td2/td2 td2/tf1 td2/tf2 td2/tf3 td2/tf4}
744 test winFCmd-7.19 {TraverseWinTree: call TraversalCopy: DOTREE_POSTD} {pcOnly} {
747 createfile td1/tf1 tf1
749 testfile cpdir td1 td2
750 list [file exists td2] [file writable td2]
752 test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} \
756 createfile td1/tf1 tf1
757 testfile rmdir -force td1
760 test winFCmd-7.21 {TraverseWinTree: fill errorPtr} {pcOnly} {
762 list [catch {testfile cpdir td1 td2} msg] $msg
765 test winFCmd-8.1 {TraversalCopy: DOTREE_F} {pcOnly} {
768 list [catch {testfile cpdir td1 td1} msg] $msg
770 test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} {pcOnly} {
774 testfile cpdir td1 td2
775 list [file writable td1] [file writable td1/td2]
777 test winFCmd-8.3 {TraversalCopy: DOTREE_POSTD} {pcOnly} {
780 testfile cpdir td1 td2
783 test winFCmd-9.1 {TraversalDelete: DOTREE_F} {pcOnly} {
787 testfile rmdir -force td1
789 test winFCmd-9.2 {TraversalDelete: DOTREE_F} {pcOnly 95} {
792 set fd [open td1/tf1 w]
793 set msg [list [catch {testfile rmdir -force td1} msg] $msg]
796 } {1 {td1\tf1 EACCES}}
797 test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} {pcOnly} {
801 testfile rmdir -force td1
804 test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} {pcOnly} {
806 file mkdir td1/td1/td3/td4/td5
807 testfile rmdir -force td1
810 test winFCmd-10.1 {AttributesPosixError - get} {pcOnly} {
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} {
816 list [catch {file attributes td1 -archive 0} msg] $msg
817 } {1 {could not read "td1": no such file or directory}}
819 test winFCmd-11.1 {GetWinFileAttributes} {pcOnly} {
822 list [catch {file attributes td1 -archive} msg] $msg [cleanup]
824 test winFCmd-11.2 {GetWinFileAttributes} {pcOnly} {
827 list [catch {file attributes td1 -readonly} msg] $msg [cleanup]
829 test winFCmd-11.3 {GetWinFileAttributes} {pcOnly} {
832 list [catch {file attributes td1 -hidden} msg] $msg [cleanup]
834 test winFCmd-11.4 {GetWinFileAttributes} {pcOnly} {
837 list [catch {file attributes td1 -system} msg] $msg [cleanup]
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.
850 test winFCmd-11.6 {GetWinFileAttributes} {pcOnly} {
851 file attr c:/ -hidden
854 test winFCmd-12.1 {ConvertFileNameFormat} {pcOnly} {
857 list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
859 test winFCmd-12.2 {ConvertFileNameFormat} {pcOnly} {
862 close [open td1/td1 w]
863 list [catch {string tolower [file attributes td1/td1 -longname]} msg] $msg [cleanup]
865 test winFCmd-12.3 {ConvertFileNameFormat} {pcOnly} {
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} {
875 list [catch {string tolower [file attributes ./td1 -longname]} msg] $msg [cleanup]
877 test winFCmd-12.5 {ConvertFileNameFormat: absolute path} {pcOnly} {
878 list [file attributes / -longname] [file attributes \\ -longname]
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]
885 test winFCmd-12.7 {ConvertFileNameFormat} {nonPortable pcOnly} {
886 string tolower [file attributes //bisque/tcl/ws -longname]
888 test winFCmd-12.8 {ConvertFileNameFormat} {pcOnly longFileNames} {
891 list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
893 test winFCmd-12.10 {ConvertFileNameFormat} {longFileNames pcOnly} {
895 close [open td1td1td1 w]
896 list [catch {file attributes td1td1td1 -shortname}] [cleanup]
898 test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames pcOnly} {
901 list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
904 test winFCmd-13.1 {GetWinFileLongName} {pcOnly} {
907 list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
910 test winFCmd-14.1 {GetWinFileShortName} {pcOnly} {
913 list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
916 test winFCmd-15.1 {SetWinFileAttributes} {pcOnly} {
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} {
923 list [catch {file attributes td1 -archive 1} msg] $msg [file attributes td1 -archive] [cleanup]
925 test winFCmd-15.3 {SetWinFileAttributes - archive} {pcOnly} {
928 list [catch {file attributes td1 -archive 0} msg] $msg [file attributes td1 -archive] [cleanup]
930 test winFCmd-15.4 {SetWinFileAttributes - hidden} {pcOnly} {
933 list [catch {file attributes td1 -hidden 1} msg] $msg [file attributes td1 -hidden] [file attributes td1 -hidden 0] [cleanup]
935 test winFCmd-15.5 {SetWinFileAttributes - hidden} {pcOnly} {
938 list [catch {file attributes td1 -hidden 0} msg] $msg [file attributes td1 -hidden] [cleanup]
940 test winFCmd-15.6 {SetWinFileAttributes - readonly} {pcOnly} {
943 list [catch {file attributes td1 -readonly 1} msg] $msg [file attributes td1 -readonly] [cleanup]
945 test winFCmd-15.7 {SetWinFileAttributes - readonly} {pcOnly} {
948 list [catch {file attributes td1 -readonly 0} msg] $msg [file attributes td1 -readonly] [cleanup]
950 test winFCmd-15.8 {SetWinFileAttributes - system} {pcOnly} {
953 list [catch {file attributes td1 -system 1} msg] $msg [file attributes td1 -system] [cleanup]
955 test winFCmd-15.9 {SetWinFileAttributes - system} {pcOnly} {
958 list [catch {file attributes td1 -system 0} msg] $msg [file attributes td1 -system] [cleanup]
960 test winFCmd-15.10 {SetWinFileAttributes - failing} {pcOnly cdrom} {
962 catch {file attributes $cdfile -archive 1}
964 test winFCmd-16.1 {Windows file normalization} {pcOnly} {
965 list [file normalize c:/] [file normalize C:/]
967 test winFCmd-16.2 {Windows file normalization} {pcOnly} {
968 close [open td1... w]
969 set res [file tail [file normalize td1]]
975 set d [string index $pwd 0]
977 test winFCmd-16.3 {Windows file normalization} {pcOnly} {
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} {
992 test winFCmd-16.8 {Windows file normalization} {pcOnly} {
995 test winFCmd-16.9 {Windows file normalization} {pcOnly} {
998 if {$d eq "C"} { set dd "D" } else { set dd "C" }
999 test winFCmd-16.10 {Windows file normalization} {pcOnly} {
1002 test winFCmd-16.11 {Windows file normalization} {pcOnly cdrom} {
1008 set result "no crash"
1010 test winFCmd-16.12 {Windows file normalization} {pcOnly} {
1012 catch {set oldhome $::env(HOME)}
1013 set ::env(HOME) ${d}:
1015 set result [pwd]; # <- Must not crash
1016 set ::env(HOME) $oldhome
1023 test winFCmd-18.1 {Windows reserved path names} -constraints win -body {
1025 } -result "absolute"
1027 test winFCmd-18.1.2 {Windows reserved path names} -constraints win -body {
1029 } -result "absolute"
1031 test winFCmd-18.1.3 {Windows reserved path names} -constraints win -body {
1033 } -result "relative"
1035 test winFCmd-18.1.4 {Windows reserved path names} -constraints win -body {
1037 } -result "absolute"
1039 test winFCmd-18.1.5 {Windows reserved path names} -constraints win -body {
1041 } -result "relative"
1043 test winFCmd-18.1.6 {Windows reserved path names} -constraints win -body {
1045 } -result "absolute"
1047 test winFCmd-18.1.7 {Windows reserved path names} -constraints win -body {
1049 } -result "relative"
1051 test winFCmd-18.2 {Windows reserved path names} -constraints win -body {
1053 } -result "absolute"
1055 test winFCmd-18.3 {Windows reserved path names} -constraints win -body {
1057 } -result "absolute"
1059 test winFCmd-18.4 {Windows reserved path names} -constraints win -body {
1061 } -result "absolute"
1063 test winFCmd-18.5 {Windows reserved path names} -constraints win -body {
1064 file normalize com1:
1067 test winFCmd-18.6 {Windows reserved path names} -constraints win -body {
1068 file normalize COM1:
1071 test winFCmd-18.7 {Windows reserved path names} -constraints win -body {
1075 test winFCmd-18.8 {Windows reserved path names} -constraints win -body {
1076 file normalize cOm1:
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} {
1087 # file delete -force ted tef
1091 # file mkdir tdempty
1092 # file mkdir tdfull/td1/td2
1094 # catch {testchmod $chmodsrc $source}
1095 # catch {testchmod $chmoddst $dest}
1097 # if [catch {file rename $source $dest} msg] {
1098 # puts "file rename $source ($chmodsrc) $dest ($chmoddst)"
1108 ::tcltest::cleanupTests