diff options
author | vincentdarley <vincentdarley> | 2004-02-28 15:46:29 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2004-02-28 15:46:29 (GMT) |
commit | 23b1014c0fb8387895fe3b847999ea8b17572bee (patch) | |
tree | 2693b71a1de138e4f046069c4ef8a3f85b3113e2 /tests | |
parent | 81e076ccf3d8390e2fa2cd46f424277d848a302a (diff) | |
download | tcl-23b1014c0fb8387895fe3b847999ea8b17572bee.zip tcl-23b1014c0fb8387895fe3b847999ea8b17572bee.tar.gz tcl-23b1014c0fb8387895fe3b847999ea8b17572bee.tar.bz2 |
more robust tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fileName.test | 8 | ||||
-rw-r--r-- | tests/fileSystem.test | 40 |
2 files changed, 34 insertions, 14 deletions
diff --git a/tests/fileName.test b/tests/fileName.test index ea9f294..fbe016c 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: fileName.test,v 1.35 2004/01/21 19:59:33 vincentdarley Exp $ +# RCS: @(#) $Id: fileName.test,v 1.36 2004/02/28 15:46:29 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -926,7 +926,11 @@ test filename-9.19.2 {Tcl_JoinPath: win} {testsetplatform winOnly} { [file join {foo\bar}] \ [file join [pwd] {foo\bar}] \ [file join [pwd] [pwd] {foo\bar}] - string map [list [pwd] pwd] $res + set nres {} + foreach elt $res { + lappend nres [string map [list [pwd] pwd] $elt] + } + set nres } {foo/bar pwd/foo/bar pwd/foo/bar} test filename-9.20 {Tcl_JoinPath: unix} {testsetplatform} { testsetplatform unix diff --git a/tests/fileSystem.test b/tests/fileSystem.test index 07f5396..c53d23c 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -32,6 +32,21 @@ makeDirectory dir.dir makeDirectory [file join dir.dir dirinside.dir] makeFile "test file in directory" [file join dir.dir inside.file] +tcltest::testConstraint unusedDrive 0 +set drive {} +if {$::tcl_platform(platform) eq "windows"} { + set vols [string map [list :/ {}] [file volumes]] + for {set i 0} {$i < 26} {incr i} { + set drive [format %c [expr {$i + 65}]] + if {[lsearch -exact $vols $drive] == -1} { + tcltest::testConstraint unusedDrive 1 + break + } + } + unset i vols + # The variable 'drive' will be used below +} + proc testPathEqual {one two} { if {[string equal $one $two]} { return 1 @@ -170,9 +185,9 @@ test filesystem-1.18 {file normalisation} {winOnly} { file normalize c:/./ } {C:/} -test filesystem-1.19 {file normalisation} {winOnly} { - file normalize w:/./../../.. -} {w:/} +test filesystem-1.19 {file normalisation} {winOnly unusedDrive} { + file normalize ${drive}:/./../../.. +} "${drive}:/" test filesystem-1.20 {file normalisation} {winOnly} { file normalize //name/foo/../ @@ -190,17 +205,17 @@ test filesystem-1.23 {file normalisation} {winOnly} { file normalize c:/./foo } {C:/foo} -test filesystem-1.24 {file normalisation} {winOnly} { - file normalize w:/./../../../a -} {w:/a} +test filesystem-1.24 {file normalisation} {winOnly unusedDrive} { + file normalize ${drive}:/./../../../a +} "${drive}:/a" -test filesystem-1.25 {file normalisation} {winOnly} { - file normalize w:/./.././../../a -} {w:/a} +test filesystem-1.25 {file normalisation} {winOnly unusedDrive} { + file normalize ${drive}:/./.././../../a +} "${drive}:/a" -test filesystem-1.25.1 {file normalisation} {winOnly} { - file normalize w:/./.././..\\..\\a\\bb -} {w:/a/bb} +test filesystem-1.25.1 {file normalisation} {winOnly unusedDrive} { + file normalize ${drive}:/./.././..\\..\\a\\bb +} "${drive}:/a/bb" test filesystem-1.26 {link normalisation: link and ..} {hasLinks} { file delete -force dir2.link @@ -813,6 +828,7 @@ test filesystem-8.3 {path objects and empty string} { } {foo foo {}} cleanupTests +unset -nocomplain drive } namespace delete ::tcl::test::fileSystem return |