summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/fileName.test13
-rw-r--r--tests/fileSystem.test114
2 files changed, 124 insertions, 3 deletions
diff --git a/tests/fileName.test b/tests/fileName.test
index e75a1b7..1a636c6 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.33 2003/10/13 16:48:07 vincentdarley Exp $
+# RCS: @(#) $Id: fileName.test,v 1.34 2003/12/12 17:02:51 vincentdarley Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -1899,8 +1899,15 @@ test filename-16.1 {windows specific globbing} {pcOnly} {
lsort [glob globTest/*.bat]
} {globTest/x1.BAT globTest/y1.Bat globTest/z1.bat}
test filename-16.2 {windows specific globbing} {pcOnly} {
- glob c:
-} c:
+ list [catch {glob c:} res] $res
+} {0 c:}
+test filename-16.2.1 {windows specific globbing} {pcOnly} {
+ set dir [pwd]
+ cd C:/
+ set res [list [catch {glob c:} err] $err]
+ cd $dir
+ set res
+} {0 c:}
test filename-16.3 {windows specific globbing} {pcOnly} {
glob c:\\\\
} c:/
diff --git a/tests/fileSystem.test b/tests/fileSystem.test
index b934aed..ff1c605 100644
--- a/tests/fileSystem.test
+++ b/tests/fileSystem.test
@@ -130,12 +130,126 @@ test filesystem-1.14 {file normalisation} {winOnly} {
file normalize c:/
} {C:/}
+test filesystem-1.15 {file normalisation} {winOnly} {
+ file normalize c:/../
+} {C:/}
+
+test filesystem-1.16 {file normalisation} {winOnly} {
+ file normalize c:/.
+} {C:/}
+
+test filesystem-1.17 {file normalisation} {winOnly} {
+ file normalize c:/..
+} {C:/}
+
+test filesystem-1.17.1 {file normalisation} {winOnly} {
+ file normalize c:\\..
+} {C:/}
+
+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.20 {file normalisation} {winOnly} {
+ file normalize //name/foo/../
+} {//name/foo}
+
+test filesystem-1.21 {file normalisation} {winOnly} {
+ file normalize C:///foo/./
+} {C:/foo}
+
+test filesystem-1.22 {file normalisation} {winOnly} {
+ file normalize //name/foo/.
+} {//name/foo}
+
+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.25 {file normalisation} {winOnly} {
+ file normalize w:/./.././../../a
+} {w:/a}
+
+test filesystem-1.25.1 {file normalisation} {winOnly} {
+ file normalize w:/./.././..\\..\\a\\bb
+} {w:/a/bb}
+
+test filesystem-1.26 {link normalisation: link and ..} {hasLinks} {
+ file delete -force dir2.link
+ set dir [file join dir2 foo bar]
+ file mkdir $dir
+ file link dir2.link [file join dir2 foo bar]
+ set res [list [file normalize [file join dir2 foo x]] \
+ [file normalize [file join dir2.link .. x]]]
+ if {![string equal [lindex $res 0] [lindex $res 1]]} {
+ set res "$res not equal"
+ } else {
+ set res "ok"
+ }
+} {ok}
+
+test filesystem-1.27 {file normalisation: up and down with ..} {
+ set dir [file join dir2 foo bar]
+ file mkdir $dir
+ set dir2 [file join dir2 .. dir2 foo .. foo bar]
+ set res [list [file normalize $dir] \
+ [file normalize $dir2]]
+ set res2 [list [file exists $dir] [file exists $dir2]]
+ if {![string equal [lindex $res 0] [lindex $res 1]]} {
+ set res "exists: $res2, $res not equal"
+ } else {
+ set res "ok: $res2"
+ }
+} {ok: 1 1}
+
+test filesystem-1.28 {link normalisation: link with .. and ..} {hasLinks} {
+ file delete -force dir2.link
+ set dir [file join dir2 foo bar]
+ file mkdir $dir
+ set to [file join dir2 .. dir2 foo .. foo bar]
+ file link dir2.link $to
+ set res [list [file normalize [file join dir2 foo x]] \
+ [file normalize [file join dir2.link .. x]]]
+ if {![string equal [lindex $res 0] [lindex $res 1]]} {
+ set res "$res not equal"
+ } else {
+ set res "ok"
+ }
+} {ok}
+
+test filesystem-1.29 {link normalisation: link with ..} {hasLinks} {
+ file delete -force dir2.link
+ set dir [file join dir2 foo bar]
+ file mkdir $dir
+ set to [file join dir2 .. dir2 foo .. foo bar]
+ file link dir2.link $to
+ set res [file normalize [file join dir2.link x yyy z]]
+ if {[string first ".." $res] != -1} {
+ set res "$res must not contain '..'"
+ } else {
+ set res "ok"
+ }
+} {ok}
+
file delete -force dir2.file
file delete -force dir2.link
file delete -force link.file dir.link
+file delete -force dir2
removeFile [file join dir.file inside.file]
removeDirectory dir.file
+test filesystem-1.30 {normalisation of nonexistent user} {
+ list [catch {file normalize ~noonewiththisname} err] $err
+} {1 {user "noonewiththisname" doesn't exist}}
+
test filesystem-2.0 {new native path} {unixOnly} {
foreach f [lsort [glob -nocomplain /usr/bin/c*]] {
catch {file readlink $f}