summaryrefslogtreecommitdiffstats
path: root/tests/fileName.test
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-09-30 14:05:44 (GMT)
committervincentdarley <vincentdarley>2003-09-30 14:05:44 (GMT)
commit62fbe6d3ac206f0bb0cfbcf84f9b60cc4a703970 (patch)
tree455fcf50a6067805d93a96cc25439f6ac2b2137f /tests/fileName.test
parent7ead8280ab4a917062c6de8aec6234eace8f610a (diff)
downloadtcl-62fbe6d3ac206f0bb0cfbcf84f9b60cc4a703970.zip
tcl-62fbe6d3ac206f0bb0cfbcf84f9b60cc4a703970.tar.gz
tcl-62fbe6d3ac206f0bb0cfbcf84f9b60cc4a703970.tar.bz2
fixed inconsistent handling of file separators in file join
Diffstat (limited to 'tests/fileName.test')
-rw-r--r--tests/fileName.test81
1 files changed, 80 insertions, 1 deletions
diff --git a/tests/fileName.test b/tests/fileName.test
index 3dce4c5..de5c655 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.31 2003/04/25 18:28:42 vincentdarley Exp $
+# RCS: @(#) $Id: fileName.test,v 1.32 2003/09/30 14:05:45 vincentdarley Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -25,6 +25,14 @@ if {[tcltest::testConstraint testsetplatform]} {
set platform [testgetplatform]
}
+# Caution: when using 'testsetplatform' to test different file
+# name platform descriptions in this file, one must be very
+# careful not to combine such platform manipulation with
+# commands like 'cd', 'pwd'. That is because the latter commands
+# operate on the real filesystem but will potentially have their
+# logic routed through the wrong generic code paths if we've
+# used 'testsetplatform'. This can lead to serious problems,
+# even crashes.
test filename-1.1 {Tcl_GetPathType: unix} {testsetplatform} {
testsetplatform unix
file pathtype /
@@ -895,6 +903,74 @@ test filename-9.18 {Tcl_JoinPath: win} {testsetplatform} {
testsetplatform win
file join foo/./bar
} {foo/./bar}
+test filename-9.19 {Tcl_JoinPath: win} {testsetplatform} {
+ testsetplatform win
+ set res {}
+ lappend res \
+ [file join {C:\foo\bar}] \
+ [file join C:/blah {C:\foo\bar}] \
+ [file join C:/blah C:/blah {C:\foo\bar}]
+} {C:/foo/bar C:/foo/bar C:/foo/bar}
+test filename-9.20 {Tcl_JoinPath: unix} {testsetplatform} {
+ testsetplatform unix
+ set res {}
+ lappend res \
+ [file join {/foo/bar}] \
+ [file join /x {/foo/bar}] \
+ [file join /x /x {/foo/bar}]
+} {/foo/bar /foo/bar /foo/bar}
+test filename-9.21 {Tcl_JoinPath: mac} {testsetplatform} {
+ testsetplatform mac
+ set res {}
+ lappend res \
+ [file join {/foo/bar}] \
+ [file join drive: {/foo/bar}] \
+ [file join drive: drive: {/foo/bar}]
+} {foo:bar foo:bar foo:bar}
+test filename-9.22 {Tcl_JoinPath: mac} {testsetplatform} {
+ testsetplatform mac
+ set res {}
+ lappend res \
+ [file join {foo:bar}] \
+ [file join drive: {foo:bar}] \
+ [file join drive: drive: {foo:bar}]
+} {foo:bar foo:bar foo:bar}
+test filename-9.23 {Tcl_JoinPath: win} {testsetplatform} {
+ testsetplatform win
+ set res {}
+ lappend res \
+ [file join {foo\bar}] \
+ [file join C:/blah {foo\bar}] \
+ [file join C:/blah C:/blah {foo\bar}]
+ string map [list C:/blah ""] $res
+} {foo/bar /foo/bar /foo/bar}
+test filename-9.24 {Tcl_JoinPath: unix} {testsetplatform} {
+ testsetplatform unix
+ set res {}
+ lappend res \
+ [file join {foo/bar}] \
+ [file join /x {foo/bar}] \
+ [file join /x /x {foo/bar}]
+ string map [list /x ""] $res
+} {foo/bar /foo/bar /foo/bar}
+test filename-9.25 {Tcl_JoinPath: mac} {testsetplatform} {
+ testsetplatform mac
+ set res {}
+ lappend res \
+ [file join {foo/bar}] \
+ [file join drive: {foo/bar}] \
+ [file join drive: drive: {foo/bar}]
+ string map [list drive: ""] $res
+} {:foo:bar foo:bar foo:bar}
+test filename-9.26 {Tcl_JoinPath: mac} {testsetplatform} {
+ testsetplatform mac
+ set res {}
+ lappend res \
+ [file join {:foo:bar}] \
+ [file join drive: {:foo:bar}] \
+ [file join drive: drive: {:foo:bar}]
+ string map [list drive: ""] $res
+} {:foo:bar foo:bar foo:bar}
test filename-10.1 {Tcl_TranslateFileName} {testsetplatform} {
testsetplatform unix
@@ -1870,6 +1946,9 @@ test filename-17.1 {windows specific special files} {testsetplatform} {
[file pathtype prn] [file pathtype nul] [file pathtype aux] \
[file pathtype foo]
} {absolute absolute absolute absolute absolute absolute relative}
+if {[tcltest::testConstraint testsetplatform]} {
+ testsetplatform $platform
+}
test filename-17.2 {windows specific glob with executable} {winOnly} {
makeDirectory execglob