os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/fileSystem.test
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/fileSystem.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,621 @@
1.4 +# This file tests the filesystem and vfs internals.
1.5 +#
1.6 +# This file contains a collection of tests for one or more of the Tcl
1.7 +# built-in commands. Sourcing this file into Tcl runs the tests and
1.8 +# generates output for errors. No output means no errors were found.
1.9 +#
1.10 +# Copyright (c) 2002 Vincent Darley.
1.11 +#
1.12 +# See the file "license.terms" for information on usage and redistribution
1.13 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.14 +
1.15 +package require tcltest 2
1.16 +namespace eval ::tcl::test::fileSystem {
1.17 +
1.18 + catch {
1.19 + namespace import ::tcltest::cleanupTests
1.20 + namespace import ::tcltest::makeDirectory
1.21 + namespace import ::tcltest::makeFile
1.22 + namespace import ::tcltest::removeDirectory
1.23 + namespace import ::tcltest::removeFile
1.24 + namespace import ::tcltest::test
1.25 + }
1.26 +
1.27 + catch {
1.28 + file delete -force link.file
1.29 + file delete -force dir.link
1.30 + file delete -force [file join dir.file linkinside.file]
1.31 + }
1.32 +
1.33 +cd [tcltest::temporaryDirectory]
1.34 +makeFile "test file" gorp.file
1.35 +makeDirectory dir.file
1.36 +makeFile "test file in directory" [file join dir.file inside.file]
1.37 +
1.38 +if {[catch {
1.39 + file link link.file gorp.file
1.40 + file link \
1.41 + [file join dir.file linkinside.file] \
1.42 + [file join dir.file inside.file]
1.43 + file link dir.link dir.file
1.44 +}]} {
1.45 + tcltest::testConstraint hasLinks 0
1.46 +} else {
1.47 + tcltest::testConstraint hasLinks 1
1.48 +}
1.49 +
1.50 +tcltest::testConstraint testsimplefilesystem \
1.51 + [string equal testsimplefilesystem [info commands testsimplefilesystem]]
1.52 +
1.53 +test filesystem-1.0 {link normalisation} {hasLinks} {
1.54 + string equal [file normalize gorp.file] [file normalize link.file]
1.55 +} {0}
1.56 +
1.57 +test filesystem-1.1 {link normalisation} {hasLinks} {
1.58 + string equal [file normalize dir.file] [file normalize dir.link]
1.59 +} {0}
1.60 +
1.61 +test filesystem-1.2 {link normalisation} {hasLinks macOrUnix} {
1.62 + string equal [file normalize [file join gorp.file foo]] \
1.63 + [file normalize [file join link.file foo]]
1.64 +} {1}
1.65 +
1.66 +test filesystem-1.3 {link normalisation} {hasLinks} {
1.67 + string equal [file normalize [file join dir.file foo]] \
1.68 + [file normalize [file join dir.link foo]]
1.69 +} {1}
1.70 +
1.71 +test filesystem-1.4 {link normalisation} {hasLinks} {
1.72 + string equal [file normalize [file join dir.file inside.file]] \
1.73 + [file normalize [file join dir.link inside.file]]
1.74 +} {1}
1.75 +
1.76 +test filesystem-1.5 {link normalisation} {hasLinks} {
1.77 + string equal [file normalize [file join dir.file linkinside.file]] \
1.78 + [file normalize [file join dir.file linkinside.file]]
1.79 +} {1}
1.80 +
1.81 +test filesystem-1.6 {link normalisation} {hasLinks} {
1.82 + string equal [file normalize [file join dir.file linkinside.file]] \
1.83 + [file normalize [file join dir.link inside.file]]
1.84 +} {0}
1.85 +
1.86 +test filesystem-1.7 {link normalisation} {hasLinks macOrUnix} {
1.87 + string equal [file normalize [file join dir.link linkinside.file foo]] \
1.88 + [file normalize [file join dir.file inside.file foo]]
1.89 +} {1}
1.90 +
1.91 +test filesystem-1.8 {link normalisation} {hasLinks} {
1.92 + string equal [file normalize [file join dir.file linkinside.filefoo]] \
1.93 + [file normalize [file join dir.link inside.filefoo]]
1.94 +} {0}
1.95 +
1.96 +test filesystem-1.9 {link normalisation} {macOrUnix hasLinks} {
1.97 + file delete -force dir.link
1.98 + file link dir.link [file nativename dir.file]
1.99 + string equal [file normalize [file join dir.file linkinside.file foo]] \
1.100 + [file normalize [file join dir.link inside.file foo]]
1.101 +} {1}
1.102 +
1.103 +test filesystem-1.10 {link normalisation: double link} {macOrUnix hasLinks} {
1.104 + file link dir2.link dir.link
1.105 + string equal [file normalize [file join dir.file linkinside.file foo]] \
1.106 + [file normalize [file join dir2.link inside.file foo]]
1.107 +} {1}
1.108 +
1.109 +makeDirectory dir2.file
1.110 +
1.111 +test filesystem-1.11 {link normalisation: double link, back in tree} {macOrUnix hasLinks} {
1.112 + file link [file join dir2.file dir2.link] dir2.link
1.113 + string equal [file normalize [file join dir.file linkinside.file foo]] \
1.114 + [file normalize [file join dir2.file dir2.link inside.file foo]]
1.115 +} {1}
1.116 +
1.117 +test filesystem-1.12 {file new native path} {} {
1.118 + for {set i 0} {$i < 10} {incr i} {
1.119 + foreach f [lsort [glob -nocomplain -type l *]] {
1.120 + catch {file readlink $f}
1.121 + }
1.122 + }
1.123 + # If we reach here we've succeeded. We used to crash above.
1.124 + expr 1
1.125 +} {1}
1.126 +
1.127 +test filesystem-1.13 {file normalisation} {winOnly} {
1.128 + # This used to be broken
1.129 + file normalize C:/thislongnamedoesntexist
1.130 +} {C:/thislongnamedoesntexist}
1.131 +
1.132 +test filesystem-1.14 {file normalisation} {winOnly} {
1.133 + # This used to be broken
1.134 + file normalize c:/
1.135 +} {C:/}
1.136 +
1.137 +file delete -force dir2.file
1.138 +file delete -force dir2.link
1.139 +file delete -force link.file dir.link
1.140 +removeFile [file join dir.file inside.file]
1.141 +removeDirectory dir.file
1.142 +
1.143 +test filesystem-2.0 {new native path} {unixOnly} {
1.144 + foreach f [lsort [glob -nocomplain /usr/bin/c*]] {
1.145 + catch {file readlink $f}
1.146 + }
1.147 + # If we reach here we've succeeded. We used to crash above.
1.148 + expr 1
1.149 +} {1}
1.150 +
1.151 +if {[catch {package require tcltest 2}]} {
1.152 + puts stderr "Skipping tests filesystem-{3,4}.*: tcltest 2 required."
1.153 +} else {
1.154 + namespace import ::tcltest::testConstraint
1.155 +
1.156 + # Is the Tcltest package loaded?
1.157 + # - that is, the special C-coded testing commands in tclTest.c
1.158 + # - tests use testing commands introduced in Tcltest 8.4
1.159 + testConstraint Tcltest [expr {
1.160 + [llength [package provide Tcltest]]
1.161 + && [package vsatisfies [package provide Tcltest] 8.4]}]
1.162 +
1.163 +# Make sure the testfilesystem hasn't been registered.
1.164 +while {![catch {testfilesystem 0}]} {}
1.165 +
1.166 +test filesystem-3.0 {Tcl_FSRegister} Tcltest {
1.167 + testfilesystem 1
1.168 +} {registered}
1.169 +
1.170 +test filesystem-3.1 {Tcl_FSUnregister} Tcltest {
1.171 + testfilesystem 0
1.172 +} {unregistered}
1.173 +
1.174 +test filesystem-3.2 {Tcl_FSUnregister} Tcltest {
1.175 + list [catch {testfilesystem 0} err] $err
1.176 +} {1 failed}
1.177 +
1.178 +test filesystem-3.3 {Tcl_FSRegister} Tcltest {
1.179 + testfilesystem 1
1.180 + testfilesystem 1
1.181 + testfilesystem 0
1.182 + testfilesystem 0
1.183 +} {unregistered}
1.184 +
1.185 +test filesystem-3.4 {Tcl_FSRegister} Tcltest {
1.186 + testfilesystem 1
1.187 + file system bar
1.188 +} {reporting}
1.189 +
1.190 +test filesystem-3.5 {Tcl_FSUnregister} Tcltest {
1.191 + testfilesystem 0
1.192 + lindex [file system bar] 0
1.193 +} {native}
1.194 +
1.195 +test filesystem-4.0 {testfilesystem} {
1.196 + -constraints Tcltest
1.197 + -match glob
1.198 + -body {
1.199 + testfilesystem 1
1.200 + set filesystemReport {}
1.201 + file exists foo
1.202 + testfilesystem 0
1.203 + set filesystemReport
1.204 + }
1.205 + -result {* {access foo}}
1.206 +}
1.207 +
1.208 +test filesystem-4.1 {testfilesystem} {
1.209 + -constraints Tcltest
1.210 + -match glob
1.211 + -body {
1.212 + testfilesystem 1
1.213 + set filesystemReport {}
1.214 + catch {file stat foo bar}
1.215 + testfilesystem 0
1.216 + set filesystemReport
1.217 + }
1.218 + -result {* {stat foo}}
1.219 +}
1.220 +
1.221 +test filesystem-4.2 {testfilesystem} {
1.222 + -constraints Tcltest
1.223 + -match glob
1.224 + -body {
1.225 + testfilesystem 1
1.226 + set filesystemReport {}
1.227 + catch {file lstat foo bar}
1.228 + testfilesystem 0
1.229 + set filesystemReport
1.230 + }
1.231 + -result {* {lstat foo}}
1.232 +}
1.233 +
1.234 +test filesystem-4.3 {testfilesystem} {
1.235 + -constraints Tcltest
1.236 + -match glob
1.237 + -body {
1.238 + testfilesystem 1
1.239 + set filesystemReport {}
1.240 + catch {glob *}
1.241 + testfilesystem 0
1.242 + set filesystemReport
1.243 + }
1.244 + -result {* {matchindirectory *}*}
1.245 +}
1.246 +
1.247 +test filesystem-5.1 {cache and ~} {
1.248 + -constraints Tcltest
1.249 + -match regexp
1.250 + -body {
1.251 + set orig $env(HOME)
1.252 + set ::env(HOME) /foo/bar/blah
1.253 + set testdir ~
1.254 + set res1 "Parent of ~ (/foo/bar/blah) is [file dirname $testdir]"
1.255 + set ::env(HOME) /a/b/c
1.256 + set res2 "Parent of ~ (/a/b/c) is [file dirname $testdir]"
1.257 + set ::env(HOME) $orig
1.258 + list $res1 $res2
1.259 + }
1.260 + -result {{Parent of ~ \(/foo/bar/blah\) is (/foo/bar|foo:bar)} {Parent of ~ \(/a/b/c\) is (/a/b|a:b)}}
1.261 +}
1.262 +
1.263 +test filesystem-6.1 {empty file name} {
1.264 + list [catch {open ""} msg] $msg
1.265 +} {1 {couldn't open "": no such file or directory}}
1.266 +
1.267 +test filesystem-6.2 {empty file name} {
1.268 + list [catch {file stat "" arr} msg] $msg
1.269 +} {1 {could not read "": no such file or directory}}
1.270 +
1.271 +test filesystem-6.3 {empty file name} {
1.272 + list [catch {file atime ""} msg] $msg
1.273 +} {1 {could not read "": no such file or directory}}
1.274 +
1.275 +test filesystem-6.4 {empty file name} {
1.276 + list [catch {file attributes ""} msg] $msg
1.277 +} {1 {could not read "": no such file or directory}}
1.278 +
1.279 +test filesystem-6.5 {empty file name} {
1.280 + list [catch {file copy "" ""} msg] $msg
1.281 +} {1 {error copying "": no such file or directory}}
1.282 +
1.283 +test filesystem-6.6 {empty file name} {
1.284 + list [catch {file delete ""} msg] $msg
1.285 +} {0 {}}
1.286 +
1.287 +test filesystem-6.7 {empty file name} {
1.288 + list [catch {file dirname ""} msg] $msg
1.289 +} {0 .}
1.290 +
1.291 +test filesystem-6.8 {empty file name} {
1.292 + list [catch {file executable ""} msg] $msg
1.293 +} {0 0}
1.294 +
1.295 +test filesystem-6.9 {empty file name} {
1.296 + list [catch {file exists ""} msg] $msg
1.297 +} {0 0}
1.298 +
1.299 +test filesystem-6.10 {empty file name} {
1.300 + list [catch {file extension ""} msg] $msg
1.301 +} {0 {}}
1.302 +
1.303 +test filesystem-6.11 {empty file name} {
1.304 + list [catch {file isdirectory ""} msg] $msg
1.305 +} {0 0}
1.306 +
1.307 +test filesystem-6.12 {empty file name} {
1.308 + list [catch {file isfile ""} msg] $msg
1.309 +} {0 0}
1.310 +
1.311 +test filesystem-6.13 {empty file name} {
1.312 + list [catch {file join ""} msg] $msg
1.313 +} {0 {}}
1.314 +
1.315 +test filesystem-6.14 {empty file name} {
1.316 + list [catch {file link ""} msg] $msg
1.317 +} {1 {could not read link "": no such file or directory}}
1.318 +
1.319 +test filesystem-6.15 {empty file name} {
1.320 + list [catch {file lstat "" arr} msg] $msg
1.321 +} {1 {could not read "": no such file or directory}}
1.322 +
1.323 +test filesystem-6.16 {empty file name} {
1.324 + list [catch {file mtime ""} msg] $msg
1.325 +} {1 {could not read "": no such file or directory}}
1.326 +
1.327 +test filesystem-6.17 {empty file name} {
1.328 + list [catch {file mtime "" 0} msg] $msg
1.329 +} {1 {could not read "": no such file or directory}}
1.330 +
1.331 +test filesystem-6.18 {empty file name} {
1.332 + list [catch {file mkdir ""} msg] $msg
1.333 +} {1 {can't create directory "": no such file or directory}}
1.334 +
1.335 +test filesystem-6.19 {empty file name} {
1.336 + list [catch {file nativename ""} msg] $msg
1.337 +} {0 {}}
1.338 +
1.339 +test filesystem-6.20 {empty file name} {
1.340 + list [catch {file normalize ""} msg] $msg
1.341 +} {0 {}}
1.342 +
1.343 +test filesystem-6.21 {empty file name} {
1.344 + list [catch {file owned ""} msg] $msg
1.345 +} {0 0}
1.346 +
1.347 +test filesystem-6.22 {empty file name} {
1.348 + list [catch {file pathtype ""} msg] $msg
1.349 +} {0 relative}
1.350 +
1.351 +test filesystem-6.23 {empty file name} {
1.352 + list [catch {file readable ""} msg] $msg
1.353 +} {0 0}
1.354 +
1.355 +test filesystem-6.24 {empty file name} {
1.356 + list [catch {file readlink ""} msg] $msg
1.357 +} {1 {could not readlink "": no such file or directory}}
1.358 +
1.359 +test filesystem-6.25 {empty file name} {
1.360 + list [catch {file rename "" ""} msg] $msg
1.361 +} {1 {error renaming "": no such file or directory}}
1.362 +
1.363 +test filesystem-6.26 {empty file name} {
1.364 + list [catch {file rootname ""} msg] $msg
1.365 +} {0 {}}
1.366 +
1.367 +test filesystem-6.27 {empty file name} {
1.368 + list [catch {file separator ""} msg] $msg
1.369 +} {1 {Unrecognised path}}
1.370 +
1.371 +test filesystem-6.28 {empty file name} {
1.372 + list [catch {file size ""} msg] $msg
1.373 +} {1 {could not read "": no such file or directory}}
1.374 +
1.375 +test filesystem-6.29 {empty file name} {
1.376 + list [catch {file split ""} msg] $msg
1.377 +} {0 {}}
1.378 +
1.379 +test filesystem-6.30 {empty file name} {
1.380 + list [catch {file system ""} msg] $msg
1.381 +} {1 {Unrecognised path}}
1.382 +
1.383 +test filesystem-6.31 {empty file name} {
1.384 + list [catch {file tail ""} msg] $msg
1.385 +} {0 {}}
1.386 +
1.387 +test filesystem-6.32 {empty file name} {
1.388 + list [catch {file type ""} msg] $msg
1.389 +} {1 {could not read "": no such file or directory}}
1.390 +
1.391 +test filesystem-6.33 {empty file name} {
1.392 + list [catch {file writable ""} msg] $msg
1.393 +} {0 0}
1.394 +
1.395 +# Make sure the testfilesystem hasn't been registered.
1.396 +while {![catch {testfilesystem 0}]} {}
1.397 +}
1.398 +
1.399 +test filesystem-7.1 {load from vfs} {win testsimplefilesystem} {
1.400 + # This may cause a crash on exit
1.401 + set dir [pwd]
1.402 + cd [file dirname [info nameof]]
1.403 + set dde [lindex [glob *dde*[info sharedlib]] 0]
1.404 + testsimplefilesystem 1
1.405 + # This loads dde via a complex copy-to-temp operation
1.406 + load simplefs:/$dde dde
1.407 + testsimplefilesystem 0
1.408 + cd $dir
1.409 + set res "ok"
1.410 + # The real result of this test is what happens when Tcl exits.
1.411 +} {ok}
1.412 +
1.413 +test filesystem-7.2 {cross-filesystem copy from vfs maintains mtime} \
1.414 + {testsimplefilesystem} {
1.415 + set dir [pwd]
1.416 + cd [tcltest::temporaryDirectory]
1.417 + # We created this file several tests ago.
1.418 + set origtime [file mtime gorp.file]
1.419 + testsimplefilesystem 1
1.420 + file delete -force theCopy
1.421 + file copy simplefs:/gorp.file theCopy
1.422 + testsimplefilesystem 0
1.423 + set newtime [file mtime theCopy]
1.424 + file delete theCopy
1.425 + cd $dir
1.426 + expr {$origtime == $newtime}
1.427 +} {1}
1.428 +
1.429 +removeFile gorp.file
1.430 +
1.431 +test filesystem-8.1 {relative path objects and caching of pwd} {
1.432 + set dir [pwd]
1.433 + cd [tcltest::temporaryDirectory]
1.434 + makeDirectory abc
1.435 + makeDirectory def
1.436 + makeFile "contents" [file join abc foo]
1.437 + cd abc
1.438 + set f "foo"
1.439 + set res {}
1.440 + lappend res [file exists $f]
1.441 + lappend res [file exists $f]
1.442 + cd ..
1.443 + cd def
1.444 + # If we haven't cleared the object's cwd cache, Tcl
1.445 + # will think it still exists.
1.446 + lappend res [file exists $f]
1.447 + lappend res [file exists $f]
1.448 + removeFile [file join abc foo]
1.449 + removeDirectory abc
1.450 + removeDirectory def
1.451 + cd $dir
1.452 + set res
1.453 +} {1 1 0 0}
1.454 +
1.455 +test filesystem-8.2 {relative path objects and use of pwd} {
1.456 + set origdir [pwd]
1.457 + cd [tcltest::temporaryDirectory]
1.458 + set dir "abc"
1.459 + makeDirectory $dir
1.460 + makeFile "contents" [file join abc foo]
1.461 + cd $dir
1.462 + set res [file exists [lindex [glob *] 0]]
1.463 + cd ..
1.464 + removeFile [file join abc foo]
1.465 + removeDirectory abc
1.466 + cd $origdir
1.467 + set res
1.468 +} {1}
1.469 +
1.470 +test filesystem-8.3 {path objects and empty string} {
1.471 + set anchor ""
1.472 + set dst foo
1.473 + set res $dst
1.474 +
1.475 + set yyy [file split $anchor]
1.476 + set dst [file join $anchor $dst]
1.477 + lappend res $dst $yyy
1.478 +} {foo foo {}}
1.479 +
1.480 +proc TestFind1 {d f} {
1.481 + set r1 [file exists [file join $d $f]]
1.482 + lappend res "[file join $d $f] found: $r1"
1.483 + lappend res "is dir a dir? [file isdirectory $d]"
1.484 + set r2 [file exists [file join $d $f]]
1.485 + lappend res "[file join $d $f] found: $r2"
1.486 + set res
1.487 +}
1.488 +proc TestFind2 {d f} {
1.489 + set r1 [file exists [file join $d $f]]
1.490 + lappend res "[file join $d $f] found: $r1"
1.491 + lappend res "is dir a dir? [file isdirectory [file join $d]]"
1.492 + set r2 [file exists [file join $d $f]]
1.493 + lappend res "[file join $d $f] found: $r2"
1.494 + set res
1.495 +}
1.496 +
1.497 +test filesystem-9.1 {path objects and join and object rep} {
1.498 + set origdir [pwd]
1.499 + cd [tcltest::temporaryDirectory]
1.500 + file mkdir [file join a b c]
1.501 + set res [TestFind1 a [file join b . c]]
1.502 + file delete -force a
1.503 + cd $origdir
1.504 + set res
1.505 +} {{a/b/./c found: 1} {is dir a dir? 1} {a/b/./c found: 1}}
1.506 +
1.507 +test filesystem-9.2 {path objects and join and object rep} {
1.508 + set origdir [pwd]
1.509 + cd [tcltest::temporaryDirectory]
1.510 + file mkdir [file join a b c]
1.511 + set res [TestFind2 a [file join b . c]]
1.512 + file delete -force a
1.513 + cd $origdir
1.514 + set res
1.515 +} {{a/b/./c found: 1} {is dir a dir? 1} {a/b/./c found: 1}}
1.516 +
1.517 +test filesystem-9.2.1 {path objects and join and object rep} {
1.518 + set origdir [pwd]
1.519 + cd [tcltest::temporaryDirectory]
1.520 + file mkdir [file join a b c]
1.521 + set res [TestFind2 a [file join b .]]
1.522 + file delete -force a
1.523 + cd $origdir
1.524 + set res
1.525 +} {{a/b/. found: 1} {is dir a dir? 1} {a/b/. found: 1}}
1.526 +
1.527 +test filesystem-9.3 {path objects and join and object rep} {
1.528 + set origdir [pwd]
1.529 + cd [tcltest::temporaryDirectory]
1.530 + file mkdir [file join a b c]
1.531 + set res [TestFind1 a [file join b .. b c]]
1.532 + file delete -force a
1.533 + cd $origdir
1.534 + set res
1.535 +} {{a/b/../b/c found: 1} {is dir a dir? 1} {a/b/../b/c found: 1}}
1.536 +
1.537 +test filesystem-9.4 {path objects and join and object rep} {
1.538 + set origdir [pwd]
1.539 + cd [tcltest::temporaryDirectory]
1.540 + file mkdir [file join a b c]
1.541 + set res [TestFind2 a [file join b .. b c]]
1.542 + file delete -force a
1.543 + cd $origdir
1.544 + set res
1.545 +} {{a/b/../b/c found: 1} {is dir a dir? 1} {a/b/../b/c found: 1}}
1.546 +
1.547 +test filesystem-9.5 {path objects and file tail and object rep} {
1.548 + set origdir [pwd]
1.549 + cd [tcltest::temporaryDirectory]
1.550 + file mkdir dgp
1.551 + close [open dgp/test w]
1.552 + foreach relative [glob -nocomplain [file join * test]] {
1.553 + set absolute [file join [pwd] $relative]
1.554 + set res [list [file tail $absolute] "test"]
1.555 + }
1.556 + file delete -force dgp
1.557 + cd $origdir
1.558 + set res
1.559 +} {test test}
1.560 +
1.561 +test filesystem-9.6 {path objects and file join and object rep} {winOnly} {
1.562 + set res {}
1.563 + set p "C:\\toto"
1.564 + lappend res [file join $p toto]
1.565 + file isdirectory $p
1.566 + lappend res [file join $p toto]
1.567 +} {C:/toto/toto C:/toto/toto}
1.568 +
1.569 +test filesystem-9.7 {path objects and glob and file tail and tilde} {
1.570 + set res {}
1.571 + set origdir [pwd]
1.572 + cd [tcltest::temporaryDirectory]
1.573 + file mkdir tilde
1.574 + close [open tilde/~testNotExist w]
1.575 + cd tilde
1.576 + set file [lindex [glob *test*] 0]
1.577 + lappend res [file exists $file] [catch {file tail $file} r] $r
1.578 + lappend res $file
1.579 + lappend res [file exists $file] [catch {file tail $file} r] $r
1.580 + lappend res [catch {file tail $file} r] $r
1.581 + cd ..
1.582 + file delete -force tilde
1.583 + cd $origdir
1.584 + set res
1.585 +} {0 1 {user "testNotExist" doesn't exist} ~testNotExist 0 1 {user "testNotExist" doesn't exist} 1 {user "testNotExist" doesn't exist}}
1.586 +test filesystem-9.8 {path objects and glob and file tail and tilde} {
1.587 + set res {}
1.588 + set origdir [pwd]
1.589 + cd [tcltest::temporaryDirectory]
1.590 + file mkdir tilde
1.591 + close [open tilde/~testNotExist w]
1.592 + cd tilde
1.593 + set file1 [lindex [glob *test*] 0]
1.594 + set file2 "~testNotExist"
1.595 + lappend res $file1 $file2
1.596 + lappend res [catch {file tail $file1} r] $r
1.597 + lappend res [catch {file tail $file2} r] $r
1.598 + cd ..
1.599 + file delete -force tilde
1.600 + cd $origdir
1.601 + set res
1.602 +} {~testNotExist ~testNotExist 1 {user "testNotExist" doesn't exist} 1 {user "testNotExist" doesn't exist}}
1.603 +test filesystem-9.9 {path objects and glob and file tail and tilde} {
1.604 + set res {}
1.605 + set origdir [pwd]
1.606 + cd [tcltest::temporaryDirectory]
1.607 + file mkdir tilde
1.608 + close [open tilde/~testNotExist w]
1.609 + cd tilde
1.610 + set file1 [lindex [glob *test*] 0]
1.611 + set file2 "~testNotExist"
1.612 + lappend res [catch {file exists $file1} r] $r
1.613 + lappend res [catch {file exists $file2} r] $r
1.614 + lappend res [string equal $file1 $file2]
1.615 + cd ..
1.616 + file delete -force tilde
1.617 + cd $origdir
1.618 + set res
1.619 +} {0 0 0 0 1}
1.620 +
1.621 +cleanupTests
1.622 +}
1.623 +namespace delete ::tcl::test::fileSystem
1.624 +return