os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/fileName.test
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/fileName.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2029 @@
1.4 +# This file tests the filename manipulation routines.
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) 1995-1996 Sun Microsystems, Inc.
1.11 +# Copyright (c) 1999 by Scriptics Corporation.
1.12 +# Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiaries. All rights reserved.
1.13 +#
1.14 +# See the file "license.terms" for information on usage and redistribution
1.15 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.16 +#
1.17 +# RCS: @(#) $Id: fileName.test,v 1.30.2.7 2005/06/21 19:07:58 kennykb Exp $
1.18 +
1.19 +if {[lsearch [namespace children] ::tcltest] == -1} {
1.20 + package require tcltest
1.21 + namespace import -force ::tcltest::*
1.22 +}
1.23 +
1.24 +tcltest::testConstraint testsetplatform [string equal testsetplatform [info commands testsetplatform]]
1.25 +tcltest::testConstraint testtranslatefilename [string equal testtranslatefilename [info commands testtranslatefilename]]
1.26 +
1.27 +global env
1.28 +if {[tcltest::testConstraint testsetplatform]} {
1.29 + set platform [testgetplatform]
1.30 +}
1.31 +
1.32 +test filename-1.1 {Tcl_GetPathType: unix} {testsetplatform} {
1.33 + testsetplatform unix
1.34 + file pathtype /
1.35 +} absolute
1.36 +test filename-1.2 {Tcl_GetPathType: unix} {testsetplatform} {
1.37 + testsetplatform unix
1.38 + file pathtype /foo
1.39 +} absolute
1.40 +test filename-1.3 {Tcl_GetPathType: unix} {testsetplatform} {
1.41 + testsetplatform unix
1.42 + file pathtype foo
1.43 +} relative
1.44 +test filename-1.4 {Tcl_GetPathType: unix} {testsetplatform} {
1.45 + testsetplatform unix
1.46 + file pathtype c:/foo
1.47 +} relative
1.48 +test filename-1.5 {Tcl_GetPathType: unix} {testsetplatform} {
1.49 + testsetplatform unix
1.50 + file pathtype ~
1.51 +} absolute
1.52 +test filename-1.6 {Tcl_GetPathType: unix} {testsetplatform} {
1.53 + testsetplatform unix
1.54 + file pathtype ~/foo
1.55 +} absolute
1.56 +test filename-1.7 {Tcl_GetPathType: unix} {testsetplatform} {
1.57 + testsetplatform unix
1.58 + file pathtype ~foo
1.59 +} absolute
1.60 +test filename-1.8 {Tcl_GetPathType: unix} {testsetplatform} {
1.61 + testsetplatform unix
1.62 + file pathtype ./~foo
1.63 +} relative
1.64 +
1.65 +test filename-2.1 {Tcl_GetPathType: mac, denerate names} {testsetplatform} {
1.66 + testsetplatform mac
1.67 + file pathtype /
1.68 +} relative
1.69 +test filename-2.2 {Tcl_GetPathType: mac, denerate names} {testsetplatform} {
1.70 + testsetplatform mac
1.71 + file pathtype /.
1.72 +} relative
1.73 +test filename-2.3 {Tcl_GetPathType: mac, denerate names} {testsetplatform} {
1.74 + testsetplatform mac
1.75 + file pathtype /..
1.76 +} relative
1.77 +test filename-2.4 {Tcl_GetPathType: mac, denerate names} {testsetplatform} {
1.78 + testsetplatform mac
1.79 + file pathtype //.//
1.80 +} relative
1.81 +test filename-2.5 {Tcl_GetPathType: mac, denerate names} {testsetplatform} {
1.82 + testsetplatform mac
1.83 + file pathtype //.//../.
1.84 +} relative
1.85 +test filename-2.6 {Tcl_GetPathType: mac, tilde names} {testsetplatform} {
1.86 + testsetplatform mac
1.87 + file pathtype ~
1.88 +} absolute
1.89 +test filename-2.7 {Tcl_GetPathType: mac, tilde names} {testsetplatform} {
1.90 + testsetplatform mac
1.91 + file pathtype ~:
1.92 +} absolute
1.93 +test filename-2.8 {Tcl_GetPathType: mac, tilde names} {testsetplatform} {
1.94 + testsetplatform mac
1.95 + file pathtype ~:foo
1.96 +} absolute
1.97 +test filename-2.9 {Tcl_GetPathType: mac, tilde names} {testsetplatform} {
1.98 + testsetplatform mac
1.99 + file pathtype ~/
1.100 +} absolute
1.101 +test filename-2.10 {Tcl_GetPathType: mac, tilde names} {testsetplatform} {
1.102 + testsetplatform mac
1.103 + file pathtype ~/foo
1.104 +} absolute
1.105 +test filename-2.11 {Tcl_GetPathType: mac, unix-style names} {testsetplatform} {
1.106 + testsetplatform mac
1.107 + file pathtype /foo
1.108 +} absolute
1.109 +test filename-2.12 {Tcl_GetPathType: mac, unix-style names} {testsetplatform} {
1.110 + testsetplatform mac
1.111 + file pathtype /./foo
1.112 +} absolute
1.113 +test filename-2.13 {Tcl_GetPathType: mac, unix-style names} {testsetplatform} {
1.114 + testsetplatform mac
1.115 + file pathtype /..//./foo
1.116 +} absolute
1.117 +test filename-2.14 {Tcl_GetPathType: mac, unix-style names} {testsetplatform} {
1.118 + testsetplatform mac
1.119 + file pathtype /foo/bar
1.120 +} absolute
1.121 +test filename-2.15 {Tcl_GetPathType: mac, unix-style names} {testsetplatform} {
1.122 + testsetplatform mac
1.123 + file pathtype foo/bar
1.124 +} relative
1.125 +test filename-2.16 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.126 + testsetplatform mac
1.127 + file pathtype :
1.128 +} relative
1.129 +test filename-2.17 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.130 + testsetplatform mac
1.131 + file pathtype :foo
1.132 +} relative
1.133 +test filename-2.18 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.134 + testsetplatform mac
1.135 + file pathtype foo:
1.136 +} absolute
1.137 +test filename-2.19 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.138 + testsetplatform mac
1.139 + file pathtype foo:bar
1.140 +} absolute
1.141 +test filename-2.20 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.142 + testsetplatform mac
1.143 + file pathtype :foo:bar
1.144 +} relative
1.145 +test filename-2.21 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.146 + testsetplatform mac
1.147 + file pathtype ::foo:bar
1.148 +} relative
1.149 +test filename-2.22 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.150 + testsetplatform mac
1.151 + file pathtype ~foo
1.152 +} absolute
1.153 +test filename-2.23 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.154 + testsetplatform mac
1.155 + file pathtype :~foo
1.156 +} relative
1.157 +test filename-2.24 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.158 + testsetplatform mac
1.159 + file pathtype ~foo:
1.160 +} absolute
1.161 +test filename-2.25 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.162 + testsetplatform mac
1.163 + file pathtype foo/bar:
1.164 +} absolute
1.165 +test filename-2.26 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.166 + testsetplatform mac
1.167 + file pathtype /foo:
1.168 +} absolute
1.169 +test filename-2.27 {Tcl_GetPathType: mac, mac-style names} {testsetplatform} {
1.170 + testsetplatform mac
1.171 + file pathtype foo
1.172 +} relative
1.173 +
1.174 +test filename-3.1 {Tcl_GetPathType: windows} {testsetplatform} {
1.175 + testsetplatform windows
1.176 + file pathtype /
1.177 +} volumerelative
1.178 +test filename-3.2 {Tcl_GetPathType: windows} {testsetplatform} {
1.179 + testsetplatform windows
1.180 + file pathtype \\
1.181 +} volumerelative
1.182 +test filename-3.3 {Tcl_GetPathType: windows} {testsetplatform} {
1.183 + testsetplatform windows
1.184 + file pathtype /foo
1.185 +} volumerelative
1.186 +test filename-3.4 {Tcl_GetPathType: windows} {testsetplatform} {
1.187 + testsetplatform windows
1.188 + file pathtype \\foo
1.189 +} volumerelative
1.190 +test filename-3.5 {Tcl_GetPathType: windows} {testsetplatform} {
1.191 + testsetplatform windows
1.192 + file pathtype c:/
1.193 +} absolute
1.194 +test filename-3.6 {Tcl_GetPathType: windows} {testsetplatform} {
1.195 + testsetplatform windows
1.196 + file pathtype c:\\
1.197 +} absolute
1.198 +test filename-3.7 {Tcl_GetPathType: windows} {testsetplatform} {
1.199 + testsetplatform windows
1.200 + file pathtype c:/foo
1.201 +} absolute
1.202 +test filename-3.8 {Tcl_GetPathType: windows} {testsetplatform} {
1.203 + testsetplatform windows
1.204 + file pathtype c:\\foo
1.205 +} absolute
1.206 +test filename-3.9 {Tcl_GetPathType: windows} {testsetplatform} {
1.207 + testsetplatform windows
1.208 + file pathtype c:
1.209 +} volumerelative
1.210 +test filename-3.10 {Tcl_GetPathType: windows} {testsetplatform} {
1.211 + testsetplatform windows
1.212 + file pathtype c:foo
1.213 +} volumerelative
1.214 +test filename-3.11 {Tcl_GetPathType: windows} {testsetplatform} {
1.215 + testsetplatform windows
1.216 + file pathtype foo
1.217 +} relative
1.218 +test filename-3.12 {Tcl_GetPathType: windows} {testsetplatform} {
1.219 + testsetplatform windows
1.220 + file pathtype //foo/bar
1.221 +} absolute
1.222 +test filename-3.13 {Tcl_GetPathType: windows} {testsetplatform} {
1.223 + testsetplatform windows
1.224 + file pathtype ~foo
1.225 +} absolute
1.226 +test filename-3.14 {Tcl_GetPathType: windows} {testsetplatform} {
1.227 + testsetplatform windows
1.228 + file pathtype ~
1.229 +} absolute
1.230 +test filename-3.15 {Tcl_GetPathType: windows} {testsetplatform} {
1.231 + testsetplatform windows
1.232 + file pathtype ~/foo
1.233 +} absolute
1.234 +test filename-3.16 {Tcl_GetPathType: windows} {testsetplatform} {
1.235 + testsetplatform windows
1.236 + file pathtype ./~foo
1.237 +} relative
1.238 +
1.239 +test filename-4.1 {Tcl_SplitPath: unix} {testsetplatform} {
1.240 + testsetplatform unix
1.241 + file split /
1.242 +} {/}
1.243 +test filename-4.2 {Tcl_SplitPath: unix} {testsetplatform} {
1.244 + testsetplatform unix
1.245 + file split /foo
1.246 +} {/ foo}
1.247 +test filename-4.3 {Tcl_SplitPath: unix} {testsetplatform} {
1.248 + testsetplatform unix
1.249 + file split /foo/bar
1.250 +} {/ foo bar}
1.251 +test filename-4.4 {Tcl_SplitPath: unix} {testsetplatform} {
1.252 + testsetplatform unix
1.253 + file split /foo/bar/baz
1.254 +} {/ foo bar baz}
1.255 +test filename-4.5 {Tcl_SplitPath: unix} {testsetplatform} {
1.256 + testsetplatform unix
1.257 + file split foo/bar
1.258 +} {foo bar}
1.259 +test filename-4.6 {Tcl_SplitPath: unix} {testsetplatform} {
1.260 + testsetplatform unix
1.261 + file split ./foo/bar
1.262 +} {. foo bar}
1.263 +test filename-4.7 {Tcl_SplitPath: unix} {testsetplatform} {
1.264 + testsetplatform unix
1.265 + file split /foo/../././foo/bar
1.266 +} {/ foo .. . . foo bar}
1.267 +test filename-4.8 {Tcl_SplitPath: unix} {testsetplatform} {
1.268 + testsetplatform unix
1.269 + file split ../foo/bar
1.270 +} {.. foo bar}
1.271 +test filename-4.9 {Tcl_SplitPath: unix} {testsetplatform} {
1.272 + testsetplatform unix
1.273 + file split {}
1.274 +} {}
1.275 +test filename-4.10 {Tcl_SplitPath: unix} {testsetplatform} {
1.276 + testsetplatform unix
1.277 + file split .
1.278 +} {.}
1.279 +test filename-4.11 {Tcl_SplitPath: unix} {testsetplatform} {
1.280 + testsetplatform unix
1.281 + file split ../
1.282 +} {..}
1.283 +test filename-4.12 {Tcl_SplitPath: unix} {testsetplatform} {
1.284 + testsetplatform unix
1.285 + file split ../..
1.286 +} {.. ..}
1.287 +test filename-4.13 {Tcl_SplitPath: unix} {testsetplatform} {
1.288 + testsetplatform unix
1.289 + file split //foo
1.290 +} {/ foo}
1.291 +test filename-4.14 {Tcl_SplitPath: unix} {testsetplatform} {
1.292 + testsetplatform unix
1.293 + file split foo//bar
1.294 +} {foo bar}
1.295 +test filename-4.15 {Tcl_SplitPath: unix} {testsetplatform} {
1.296 + testsetplatform unix
1.297 + file split ~foo
1.298 +} {~foo}
1.299 +test filename-4.16 {Tcl_SplitPath: unix} {testsetplatform} {
1.300 + testsetplatform unix
1.301 + file split ~foo/~bar
1.302 +} {~foo ./~bar}
1.303 +test filename-4.17 {Tcl_SplitPath: unix} {testsetplatform} {
1.304 + testsetplatform unix
1.305 + file split ~foo/~bar/~baz
1.306 +} {~foo ./~bar ./~baz}
1.307 +test filename-4.18 {Tcl_SplitPath: unix} {testsetplatform} {
1.308 + testsetplatform unix
1.309 + file split foo/bar~/baz
1.310 +} {foo bar~ baz}
1.311 +
1.312 +if {[tcltest::testConstraint testsetplatform]} {
1.313 + testsetplatform $platform
1.314 +}
1.315 +
1.316 +test filename-4.19 {Tcl_SplitPath} {
1.317 + set oldDir [pwd]
1.318 + set res [catch {
1.319 + cd [temporaryDirectory]
1.320 + file mkdir tildetmp
1.321 + set nastydir [file join tildetmp ./~tilde]
1.322 + file mkdir $nastydir
1.323 + set norm [file normalize $nastydir]
1.324 + cd tildetmp
1.325 + cd ./~tilde
1.326 + glob -nocomplain *
1.327 + set idx [string first tildetmp $norm]
1.328 + set norm [string range $norm $idx end]
1.329 + # fix path away so all platforms are the same
1.330 + regsub {(.*):$} $norm {\1} norm
1.331 + regsub -all ":" $norm "/" norm
1.332 + # make sure we can delete the directory we created
1.333 + cd $oldDir
1.334 + file delete -force $nastydir
1.335 + set norm
1.336 + } err]
1.337 + cd $oldDir
1.338 + catch {file delete -force [file join [temporaryDirectory] tildetmp]}
1.339 + list $res $err
1.340 +} {0 tildetmp/~tilde}
1.341 +
1.342 +test filename-5.1 {Tcl_SplitPath: mac} {testsetplatform} {
1.343 + testsetplatform mac
1.344 + file split a:b
1.345 +} {a: b}
1.346 +test filename-5.2 {Tcl_SplitPath: mac} {testsetplatform} {
1.347 + testsetplatform mac
1.348 + file split a:b:c
1.349 +} {a: b c}
1.350 +test filename-5.3 {Tcl_SplitPath: mac} {testsetplatform} {
1.351 + testsetplatform mac
1.352 + file split a:b:c:
1.353 +} {a: b c}
1.354 +test filename-5.4 {Tcl_SplitPath: mac} {testsetplatform} {
1.355 + testsetplatform mac
1.356 + file split a:
1.357 +} {a:}
1.358 +test filename-5.5 {Tcl_SplitPath: mac} {testsetplatform} {
1.359 + testsetplatform mac
1.360 + file split a::
1.361 +} {a: ::}
1.362 +test filename-5.6 {Tcl_SplitPath: mac} {testsetplatform} {
1.363 + testsetplatform mac
1.364 + file split a:::
1.365 +} {a: :: ::}
1.366 +test filename-5.7 {Tcl_SplitPath: mac} {testsetplatform} {
1.367 + testsetplatform mac
1.368 + file split :a
1.369 +} {a}
1.370 +test filename-5.8 {Tcl_SplitPath: mac} {testsetplatform} {
1.371 + testsetplatform mac
1.372 + file split :a::
1.373 +} {a ::}
1.374 +test filename-5.9 {Tcl_SplitPath: mac} {testsetplatform} {
1.375 + testsetplatform mac
1.376 + file split :
1.377 +} {:}
1.378 +test filename-5.10 {Tcl_SplitPath: mac} {testsetplatform} {
1.379 + testsetplatform mac
1.380 + file split ::
1.381 +} {::}
1.382 +test filename-5.11 {Tcl_SplitPath: mac} {testsetplatform} {
1.383 + testsetplatform mac
1.384 + file split :::
1.385 +} {:: ::}
1.386 +test filename-5.12 {Tcl_SplitPath: mac} {testsetplatform} {
1.387 + testsetplatform mac
1.388 + file split a:::b
1.389 +} {a: :: :: b}
1.390 +test filename-5.13 {Tcl_SplitPath: mac} {testsetplatform} {
1.391 + testsetplatform mac
1.392 + file split /a:b
1.393 +} {/a: b}
1.394 +test filename-5.14 {Tcl_SplitPath: mac} {testsetplatform} {
1.395 + testsetplatform mac
1.396 + file split ~:
1.397 +} {~:}
1.398 +test filename-5.15 {Tcl_SplitPath: mac} {testsetplatform} {
1.399 + testsetplatform mac
1.400 + file split ~/:
1.401 +} {~/:}
1.402 +test filename-5.16 {Tcl_SplitPath: mac} {testsetplatform} {
1.403 + testsetplatform mac
1.404 + file split ~:foo
1.405 +} {~: foo}
1.406 +test filename-5.17 {Tcl_SplitPath: mac} {testsetplatform} {
1.407 + testsetplatform mac
1.408 + file split ~/foo
1.409 +} {~: foo}
1.410 +test filename-5.18 {Tcl_SplitPath: mac} {testsetplatform} {
1.411 + testsetplatform mac
1.412 + file split ~foo:
1.413 +} {~foo:}
1.414 +test filename-5.19 {Tcl_SplitPath: mac} {testsetplatform} {
1.415 + testsetplatform mac
1.416 + file split a:~foo
1.417 +} {a: :~foo}
1.418 +test filename-5.20 {Tcl_SplitPath: mac} {testsetplatform} {
1.419 + testsetplatform mac
1.420 + file split /
1.421 +} {:/}
1.422 +test filename-5.21 {Tcl_SplitPath: mac} {testsetplatform} {
1.423 + testsetplatform mac
1.424 + file split a:b/c
1.425 +} {a: :b/c}
1.426 +test filename-5.22 {Tcl_SplitPath: mac} {testsetplatform} {
1.427 + testsetplatform mac
1.428 + file split /foo
1.429 +} {foo:}
1.430 +test filename-5.23 {Tcl_SplitPath: mac} {testsetplatform} {
1.431 + testsetplatform mac
1.432 + file split /a/b
1.433 +} {a: b}
1.434 +test filename-5.24 {Tcl_SplitPath: mac} {testsetplatform} {
1.435 + testsetplatform mac
1.436 + file split /a/b/foo
1.437 +} {a: b foo}
1.438 +test filename-5.25 {Tcl_SplitPath: mac} {testsetplatform} {
1.439 + testsetplatform mac
1.440 + file split a/b
1.441 +} {a b}
1.442 +test filename-5.26 {Tcl_SplitPath: mac} {testsetplatform} {
1.443 + testsetplatform mac
1.444 + file split ./foo/bar
1.445 +} {: foo bar}
1.446 +test filename-5.27 {Tcl_SplitPath: mac} {testsetplatform} {
1.447 + testsetplatform mac
1.448 + file split ../foo/bar
1.449 +} {:: foo bar}
1.450 +test filename-5.28 {Tcl_SplitPath: mac} {testsetplatform} {
1.451 + testsetplatform mac
1.452 + file split {}
1.453 +} {}
1.454 +test filename-5.29 {Tcl_SplitPath: mac} {testsetplatform} {
1.455 + testsetplatform mac
1.456 + file split .
1.457 +} {:}
1.458 +test filename-5.30 {Tcl_SplitPath: mac} {testsetplatform} {
1.459 + testsetplatform mac
1.460 + file split ././
1.461 +} {: :}
1.462 +test filename-5.31 {Tcl_SplitPath: mac} {testsetplatform} {
1.463 + testsetplatform mac
1.464 + file split ././.
1.465 +} {: : :}
1.466 +test filename-5.32 {Tcl_SplitPath: mac} {testsetplatform} {
1.467 + testsetplatform mac
1.468 + file split ../
1.469 +} {::}
1.470 +test filename-5.33 {Tcl_SplitPath: mac} {testsetplatform} {
1.471 + testsetplatform mac
1.472 + file split ..
1.473 +} {::}
1.474 +test filename-5.34 {Tcl_SplitPath: mac} {testsetplatform} {
1.475 + testsetplatform mac
1.476 + file split ../..
1.477 +} {:: ::}
1.478 +test filename-5.35 {Tcl_SplitPath: mac} {testsetplatform} {
1.479 + testsetplatform mac
1.480 + file split //foo
1.481 +} {foo:}
1.482 +test filename-5.36 {Tcl_SplitPath: mac} {testsetplatform} {
1.483 + testsetplatform mac
1.484 + file split foo//bar
1.485 +} {foo bar}
1.486 +test filename-5.37 {Tcl_SplitPath: mac} {testsetplatform} {
1.487 + testsetplatform mac
1.488 + file split ~foo
1.489 +} {~foo:}
1.490 +test filename-5.38 {Tcl_SplitPath: mac} {testsetplatform} {
1.491 + testsetplatform mac
1.492 + file split ~
1.493 +} {~:}
1.494 +test filename-5.39 {Tcl_SplitPath: mac} {testsetplatform} {
1.495 + testsetplatform mac
1.496 + file split foo
1.497 +} {foo}
1.498 +test filename-5.40 {Tcl_SplitPath: mac} {testsetplatform} {
1.499 + testsetplatform mac
1.500 + file split ~/
1.501 +} {~:}
1.502 +test filename-5.41 {Tcl_SplitPath: mac} {testsetplatform} {
1.503 + testsetplatform mac
1.504 + file split ~foo/~bar
1.505 +} {~foo: :~bar}
1.506 +test filename-5.42 {Tcl_SplitPath: mac} {testsetplatform} {
1.507 + testsetplatform mac
1.508 + file split ~foo/~bar/~baz
1.509 +} {~foo: :~bar :~baz}
1.510 +test filename-5.43 {Tcl_SplitPath: mac} {testsetplatform} {
1.511 + testsetplatform mac
1.512 + file split foo/bar~/baz
1.513 +} {foo bar~ baz}
1.514 +test filename-5.44 {Tcl_SplitPath: mac} {testsetplatform} {
1.515 + testsetplatform mac
1.516 + file split a/../b
1.517 +} {a :: b}
1.518 +test filename-5.45 {Tcl_SplitPath: mac} {testsetplatform} {
1.519 + testsetplatform mac
1.520 + file split a/../../b
1.521 +} {a :: :: b}
1.522 +test filename-5.46 {Tcl_SplitPath: mac} {testsetplatform} {
1.523 + testsetplatform mac
1.524 + file split a/.././../b
1.525 +} {a :: : :: b}
1.526 +test filename-5.47 {Tcl_SplitPath: mac} {testsetplatform} {
1.527 + testsetplatform mac
1.528 + file split /../bar
1.529 +} {bar:}
1.530 +test filename-5.48 {Tcl_SplitPath: mac} {testsetplatform} {
1.531 + testsetplatform mac
1.532 + file split /./bar
1.533 +} {bar:}
1.534 +test filename-5.49 {Tcl_SplitPath: mac} {testsetplatform} {
1.535 + testsetplatform mac
1.536 + file split //.//.././bar
1.537 +} {bar:}
1.538 +test filename-5.50 {Tcl_SplitPath: mac} {testsetplatform} {
1.539 + testsetplatform mac
1.540 + file split /..
1.541 +} {:/..}
1.542 +test filename-5.51 {Tcl_SplitPath: mac} {testsetplatform} {
1.543 + testsetplatform mac
1.544 + file split //.//.././
1.545 +} {://.//.././}
1.546 +
1.547 +test filename-6.1 {Tcl_SplitPath: win} {testsetplatform} {
1.548 + testsetplatform win
1.549 + file split /
1.550 +} {/}
1.551 +test filename-6.2 {Tcl_SplitPath: win} {testsetplatform} {
1.552 + testsetplatform win
1.553 + file split /foo
1.554 +} {/ foo}
1.555 +test filename-6.3 {Tcl_SplitPath: win} {testsetplatform} {
1.556 + testsetplatform win
1.557 + file split /foo/bar
1.558 +} {/ foo bar}
1.559 +test filename-6.4 {Tcl_SplitPath: win} {testsetplatform} {
1.560 + testsetplatform win
1.561 + file split /foo/bar/baz
1.562 +} {/ foo bar baz}
1.563 +test filename-6.5 {Tcl_SplitPath: win} {testsetplatform} {
1.564 + testsetplatform win
1.565 + file split foo/bar
1.566 +} {foo bar}
1.567 +test filename-6.6 {Tcl_SplitPath: win} {testsetplatform} {
1.568 + testsetplatform win
1.569 + file split ./foo/bar
1.570 +} {. foo bar}
1.571 +test filename-6.7 {Tcl_SplitPath: win} {testsetplatform} {
1.572 + testsetplatform win
1.573 + file split /foo/../././foo/bar
1.574 +} {/ foo .. . . foo bar}
1.575 +test filename-6.8 {Tcl_SplitPath: win} {testsetplatform} {
1.576 + testsetplatform win
1.577 + file split ../foo/bar
1.578 +} {.. foo bar}
1.579 +test filename-6.9 {Tcl_SplitPath: win} {testsetplatform} {
1.580 + testsetplatform win
1.581 + file split {}
1.582 +} {}
1.583 +test filename-6.10 {Tcl_SplitPath: win} {testsetplatform} {
1.584 + testsetplatform win
1.585 + file split .
1.586 +} {.}
1.587 +test filename-6.11 {Tcl_SplitPath: win} {testsetplatform} {
1.588 + testsetplatform win
1.589 + file split ../
1.590 +} {..}
1.591 +test filename-6.12 {Tcl_SplitPath: win} {testsetplatform} {
1.592 + testsetplatform win
1.593 + file split ../..
1.594 +} {.. ..}
1.595 +test filename-6.13 {Tcl_SplitPath: win} {testsetplatform} {
1.596 + testsetplatform win
1.597 + file split //foo
1.598 +} {/ foo}
1.599 +test filename-6.14 {Tcl_SplitPath: win} {testsetplatform} {
1.600 + testsetplatform win
1.601 + file split foo//bar
1.602 +} {foo bar}
1.603 +test filename-6.15 {Tcl_SplitPath: win} {testsetplatform} {
1.604 + testsetplatform win
1.605 + file split /\\/foo//bar
1.606 +} {//foo/bar}
1.607 +test filename-6.16 {Tcl_SplitPath: win} {testsetplatform} {
1.608 + testsetplatform win
1.609 + file split /\\/foo//bar
1.610 +} {//foo/bar}
1.611 +test filename-6.17 {Tcl_SplitPath: win} {testsetplatform} {
1.612 + testsetplatform win
1.613 + file split /\\/foo//bar
1.614 +} {//foo/bar}
1.615 +test filename-6.18 {Tcl_SplitPath: win} {testsetplatform} {
1.616 + testsetplatform win
1.617 + file split \\\\foo\\bar
1.618 +} {//foo/bar}
1.619 +test filename-6.19 {Tcl_SplitPath: win} {testsetplatform} {
1.620 + testsetplatform win
1.621 + file split \\\\foo\\bar/baz
1.622 +} {//foo/bar baz}
1.623 +test filename-6.20 {Tcl_SplitPath: win} {testsetplatform} {
1.624 + testsetplatform win
1.625 + file split c:/foo
1.626 +} {c:/ foo}
1.627 +test filename-6.21 {Tcl_SplitPath: win} {testsetplatform} {
1.628 + testsetplatform win
1.629 + file split c:foo
1.630 +} {c: foo}
1.631 +test filename-6.22 {Tcl_SplitPath: win} {testsetplatform} {
1.632 + testsetplatform win
1.633 + file split c:
1.634 +} {c:}
1.635 +test filename-6.23 {Tcl_SplitPath: win} {testsetplatform} {
1.636 + testsetplatform win
1.637 + file split c:\\
1.638 +} {c:/}
1.639 +test filename-6.24 {Tcl_SplitPath: win} {testsetplatform} {
1.640 + testsetplatform win
1.641 + file split c:/
1.642 +} {c:/}
1.643 +test filename-6.25 {Tcl_SplitPath: win} {testsetplatform} {
1.644 + testsetplatform win
1.645 + file split c:/./..
1.646 +} {c:/ . ..}
1.647 +test filename-6.26 {Tcl_SplitPath: win} {testsetplatform} {
1.648 + testsetplatform win
1.649 + file split ~foo
1.650 +} {~foo}
1.651 +test filename-6.27 {Tcl_SplitPath: win} {testsetplatform} {
1.652 + testsetplatform win
1.653 + file split ~foo/~bar
1.654 +} {~foo ./~bar}
1.655 +test filename-6.28 {Tcl_SplitPath: win} {testsetplatform} {
1.656 + testsetplatform win
1.657 + file split ~foo/~bar/~baz
1.658 +} {~foo ./~bar ./~baz}
1.659 +test filename-6.29 {Tcl_SplitPath: win} {testsetplatform} {
1.660 + testsetplatform win
1.661 + file split foo/bar~/baz
1.662 +} {foo bar~ baz}
1.663 +test filename-6.30 {Tcl_SplitPath: win} {testsetplatform} {
1.664 + testsetplatform win
1.665 + file split c:~foo
1.666 +} {c: ./~foo}
1.667 +
1.668 +test filename-7.1 {Tcl_JoinPath: unix} {testsetplatform} {
1.669 + testsetplatform unix
1.670 + file join / a
1.671 +} {/a}
1.672 +test filename-7.2 {Tcl_JoinPath: unix} {testsetplatform} {
1.673 + testsetplatform unix
1.674 + file join a b
1.675 +} {a/b}
1.676 +test filename-7.3 {Tcl_JoinPath: unix} {testsetplatform} {
1.677 + testsetplatform unix
1.678 + file join /a c /b d
1.679 +} {/b/d}
1.680 +test filename-7.4 {Tcl_JoinPath: unix} {testsetplatform} {
1.681 + testsetplatform unix
1.682 + file join /
1.683 +} {/}
1.684 +test filename-7.5 {Tcl_JoinPath: unix} {testsetplatform} {
1.685 + testsetplatform unix
1.686 + file join a
1.687 +} {a}
1.688 +test filename-7.6 {Tcl_JoinPath: unix} {testsetplatform} {
1.689 + testsetplatform unix
1.690 + file join {}
1.691 +} {}
1.692 +test filename-7.7 {Tcl_JoinPath: unix} {testsetplatform} {
1.693 + testsetplatform unix
1.694 + file join /a/ b
1.695 +} {/a/b}
1.696 +test filename-7.8 {Tcl_JoinPath: unix} {testsetplatform} {
1.697 + testsetplatform unix
1.698 + file join /a// b
1.699 +} {/a/b}
1.700 +test filename-7.9 {Tcl_JoinPath: unix} {testsetplatform} {
1.701 + testsetplatform unix
1.702 + file join /a/./../. b
1.703 +} {/a/./.././b}
1.704 +test filename-7.10 {Tcl_JoinPath: unix} {testsetplatform} {
1.705 + testsetplatform unix
1.706 + file join ~ a
1.707 +} {~/a}
1.708 +test filename-7.11 {Tcl_JoinPath: unix} {testsetplatform} {
1.709 + testsetplatform unix
1.710 + file join ~a ~b
1.711 +} {~b}
1.712 +test filename-7.12 {Tcl_JoinPath: unix} {testsetplatform} {
1.713 + testsetplatform unix
1.714 + file join ./~a b
1.715 +} {./~a/b}
1.716 +test filename-7.13 {Tcl_JoinPath: unix} {testsetplatform} {
1.717 + testsetplatform unix
1.718 + file join ./~a ~b
1.719 +} {~b}
1.720 +test filename-7.14 {Tcl_JoinPath: unix} {testsetplatform} {
1.721 + testsetplatform unix
1.722 + file join ./~a ./~b
1.723 +} {./~a/~b}
1.724 +test filename-7.15 {Tcl_JoinPath: unix} {testsetplatform} {
1.725 + testsetplatform unix
1.726 + file join a . b
1.727 +} {a/./b}
1.728 +test filename-7.16 {Tcl_JoinPath: unix} {testsetplatform} {
1.729 + testsetplatform unix
1.730 + file join a . ./~b
1.731 +} {a/./~b}
1.732 +test filename-7.17 {Tcl_JoinPath: unix} {testsetplatform} {
1.733 + testsetplatform unix
1.734 + file join //a b
1.735 +} {/a/b}
1.736 +test filename-7.18 {Tcl_JoinPath: unix} {testsetplatform} {
1.737 + testsetplatform unix
1.738 + file join /// a b
1.739 +} {/a/b}
1.740 +
1.741 +test filename-8.1 {Tcl_JoinPath: mac} {testsetplatform} {
1.742 + testsetplatform mac
1.743 + file join a b
1.744 +} {:a:b}
1.745 +test filename-8.2 {Tcl_JoinPath: mac} {testsetplatform} {
1.746 + testsetplatform mac
1.747 + file join :a b
1.748 +} {:a:b}
1.749 +test filename-8.3 {Tcl_JoinPath: mac} {testsetplatform} {
1.750 + testsetplatform mac
1.751 + file join a b:
1.752 +} {b:}
1.753 +test filename-8.4 {Tcl_JoinPath: mac} {testsetplatform} {
1.754 + testsetplatform mac
1.755 + file join a: :b
1.756 +} {a:b}
1.757 +test filename-8.5 {Tcl_JoinPath: mac} {testsetplatform} {
1.758 + testsetplatform mac
1.759 + file join a: :b:
1.760 +} {a:b}
1.761 +test filename-8.6 {Tcl_JoinPath: mac} {testsetplatform} {
1.762 + testsetplatform mac
1.763 + file join a :: b
1.764 +} {:a::b}
1.765 +test filename-8.7 {Tcl_JoinPath: mac} {testsetplatform} {
1.766 + testsetplatform mac
1.767 + file join a :: :: b
1.768 +} {:a:::b}
1.769 +test filename-8.8 {Tcl_JoinPath: mac} {testsetplatform} {
1.770 + testsetplatform mac
1.771 + file join a ::: b
1.772 +} {:a:::b}
1.773 +test filename-8.9 {Tcl_JoinPath: mac} {testsetplatform} {
1.774 + testsetplatform mac
1.775 + file join a: b:
1.776 +} {b:}
1.777 +test filename-8.10 {Tcl_JoinPath: mac} {testsetplatform} {
1.778 + testsetplatform mac
1.779 + file join /a/b
1.780 +} {a:b}
1.781 +test filename-8.11 {Tcl_JoinPath: mac} {testsetplatform} {
1.782 + testsetplatform mac
1.783 + file join /a/b c/d
1.784 +} {a:b:c:d}
1.785 +test filename-8.12 {Tcl_JoinPath: mac} {testsetplatform} {
1.786 + testsetplatform mac
1.787 + file join /a/b :c:d
1.788 +} {a:b:c:d}
1.789 +test filename-8.13 {Tcl_JoinPath: mac} {testsetplatform} {
1.790 + testsetplatform mac
1.791 + file join ~ foo
1.792 +} {~:foo}
1.793 +test filename-8.14 {Tcl_JoinPath: mac} {testsetplatform} {
1.794 + testsetplatform mac
1.795 + file join :: ::
1.796 +} {:::}
1.797 +test filename-8.15 {Tcl_JoinPath: mac} {testsetplatform} {
1.798 + testsetplatform mac
1.799 + file join a: ::
1.800 +} {a::}
1.801 +test filename-8.16 {Tcl_JoinPath: mac} {testsetplatform} {
1.802 + testsetplatform mac
1.803 + file join a {} b
1.804 +} {:a:b}
1.805 +test filename-8.17 {Tcl_JoinPath: mac} {testsetplatform} {
1.806 + testsetplatform mac
1.807 + file join a::: b
1.808 +} {a:::b}
1.809 +test filename-8.18 {Tcl_JoinPath: mac} {testsetplatform} {
1.810 + testsetplatform mac
1.811 + file join a : : :
1.812 +} {:a}
1.813 +test filename-8.19 {Tcl_JoinPath: mac} {testsetplatform} {
1.814 + testsetplatform mac
1.815 + file join :
1.816 +} {:}
1.817 +test filename-8.20 {Tcl_JoinPath: mac} {testsetplatform} {
1.818 + testsetplatform mac
1.819 + file join : a
1.820 +} {:a}
1.821 +test filename-8.21 {Tcl_JoinPath: mac} {testsetplatform} {
1.822 + testsetplatform mac
1.823 + file join a: :b/c
1.824 +} {a:b/c}
1.825 +test filename-8.22 {Tcl_JoinPath: mac} {testsetplatform} {
1.826 + testsetplatform mac
1.827 + file join :a :b/c
1.828 +} {:a:b/c}
1.829 +
1.830 +test filename-9.1 {Tcl_JoinPath: win} {testsetplatform} {
1.831 + testsetplatform win
1.832 + file join a b
1.833 +} {a/b}
1.834 +test filename-9.2 {Tcl_JoinPath: win} {testsetplatform} {
1.835 + testsetplatform win
1.836 + file join /a b
1.837 +} {/a/b}
1.838 +test filename-9.3 {Tcl_JoinPath: win} {testsetplatform} {
1.839 + testsetplatform win
1.840 + file join /a /b
1.841 +} {/b}
1.842 +test filename-9.4 {Tcl_JoinPath: win} {testsetplatform} {
1.843 + testsetplatform win
1.844 + file join c: foo
1.845 +} {c:foo}
1.846 +test filename-9.5 {Tcl_JoinPath: win} {testsetplatform} {
1.847 + testsetplatform win
1.848 + file join c:/ foo
1.849 +} {c:/foo}
1.850 +test filename-9.6 {Tcl_JoinPath: win} {testsetplatform} {
1.851 + testsetplatform win
1.852 + file join c:\\bar foo
1.853 +} {c:/bar/foo}
1.854 +test filename-9.7 {Tcl_JoinPath: win} {testsetplatform} {
1.855 + testsetplatform win
1.856 + file join /foo c:bar
1.857 +} {c:bar}
1.858 +test filename-9.8 {Tcl_JoinPath: win} {testsetplatform} {
1.859 + testsetplatform win
1.860 + file join ///host//share dir
1.861 +} {//host/share/dir}
1.862 +test filename-9.9 {Tcl_JoinPath: win} {testsetplatform} {
1.863 + testsetplatform win
1.864 + file join ~ foo
1.865 +} {~/foo}
1.866 +test filename-9.10 {Tcl_JoinPath: win} {testsetplatform} {
1.867 + testsetplatform win
1.868 + file join ~/~foo
1.869 +} {~/~foo}
1.870 +test filename-9.11 {Tcl_JoinPath: win} {testsetplatform} {
1.871 + testsetplatform win
1.872 + file join ~ ./~foo
1.873 +} {~/~foo}
1.874 +test filename-9.12 {Tcl_JoinPath: win} {testsetplatform} {
1.875 + testsetplatform win
1.876 + file join / ~foo
1.877 +} {~foo}
1.878 +test filename-9.13 {Tcl_JoinPath: win} {testsetplatform} {
1.879 + testsetplatform win
1.880 + file join ./a/ b c
1.881 +} {./a/b/c}
1.882 +test filename-9.14 {Tcl_JoinPath: win} {testsetplatform} {
1.883 + testsetplatform win
1.884 + file join ./~a/ b c
1.885 +} {./~a/b/c}
1.886 +test filename-9.15 {Tcl_JoinPath: win} {testsetplatform} {
1.887 + testsetplatform win
1.888 + file join // host share path
1.889 +} {/host/share/path}
1.890 +test filename-9.16 {Tcl_JoinPath: win} {testsetplatform} {
1.891 + testsetplatform win
1.892 + file join foo . bar
1.893 +} {foo/./bar}
1.894 +test filename-9.17 {Tcl_JoinPath: win} {testsetplatform} {
1.895 + testsetplatform win
1.896 + file join foo .. bar
1.897 +} {foo/../bar}
1.898 +test filename-9.18 {Tcl_JoinPath: win} {testsetplatform} {
1.899 + testsetplatform win
1.900 + file join foo/./bar
1.901 +} {foo/./bar}
1.902 +test filename-9.19 {Tcl_JoinPath: win} {testsetplatform} {
1.903 + testsetplatform win
1.904 + set res {}
1.905 + lappend res \
1.906 + [file join {C:\foo\bar}] \
1.907 + [file join C:/blah {C:\foo\bar}] \
1.908 + [file join C:/blah C:/blah {C:\foo\bar}]
1.909 +} {C:/foo/bar C:/foo/bar C:/foo/bar}
1.910 +test filename-9.19.1 {Tcl_JoinPath: win} {testsetplatform} {
1.911 + testsetplatform win
1.912 + set res {}
1.913 + lappend res \
1.914 + [file join {foo\bar}] \
1.915 + [file join C:/blah {foo\bar}] \
1.916 + [file join C:/blah C:/blah {foo\bar}]
1.917 +} {foo/bar C:/blah/foo/bar C:/blah/foo/bar}
1.918 +test filename-9.19.2 {Tcl_JoinPath: win} {testsetplatform winOnly} {
1.919 + testsetplatform win
1.920 + set res {}
1.921 + lappend res \
1.922 + [file join {foo\bar}] \
1.923 + [file join [pwd] {foo\bar}] \
1.924 + [file join [pwd] [pwd] {foo\bar}]
1.925 + string map [list [pwd] pwd] $res
1.926 +} {foo/bar pwd/foo/bar pwd/foo/bar}
1.927 +test filename-9.20 {Tcl_JoinPath: unix} {testsetplatform} {
1.928 + testsetplatform unix
1.929 + set res {}
1.930 + lappend res \
1.931 + [file join {/foo/bar}] \
1.932 + [file join /x {/foo/bar}] \
1.933 + [file join /x /x {/foo/bar}]
1.934 +} {/foo/bar /foo/bar /foo/bar}
1.935 +test filename-9.21 {Tcl_JoinPath: mac} {testsetplatform} {
1.936 + testsetplatform mac
1.937 + set res {}
1.938 + lappend res \
1.939 + [file join {/foo/bar}] \
1.940 + [file join drive: {/foo/bar}] \
1.941 + [file join drive: drive: {/foo/bar}]
1.942 +} {foo:bar foo:bar foo:bar}
1.943 +test filename-9.22 {Tcl_JoinPath: mac} {testsetplatform} {
1.944 + testsetplatform mac
1.945 + set res {}
1.946 + lappend res \
1.947 + [file join {foo:bar}] \
1.948 + [file join drive: {foo:bar}] \
1.949 + [file join drive: drive: {foo:bar}]
1.950 +} {foo:bar foo:bar foo:bar}
1.951 +test filename-9.23 {Tcl_JoinPath: win} {testsetplatform} {
1.952 + testsetplatform win
1.953 + set res {}
1.954 + lappend res \
1.955 + [file join {foo\bar}] \
1.956 + [file join C:/blah {foo\bar}] \
1.957 + [file join C:/blah C:/blah {foo\bar}]
1.958 + string map [list C:/blah ""] $res
1.959 +} {foo/bar /foo/bar /foo/bar}
1.960 +test filename-9.24 {Tcl_JoinPath: unix} {testsetplatform} {
1.961 + testsetplatform unix
1.962 + set res {}
1.963 + lappend res \
1.964 + [file join {foo/bar}] \
1.965 + [file join /x {foo/bar}] \
1.966 + [file join /x /x {foo/bar}]
1.967 + string map [list /x ""] $res
1.968 +} {foo/bar /foo/bar /foo/bar}
1.969 +test filename-9.25 {Tcl_JoinPath: mac} {testsetplatform} {
1.970 + testsetplatform mac
1.971 + set res {}
1.972 + lappend res \
1.973 + [file join {foo/bar}] \
1.974 + [file join drive: {foo/bar}] \
1.975 + [file join drive: drive: {foo/bar}]
1.976 + string map [list drive: ""] $res
1.977 +} {:foo:bar foo:bar foo:bar}
1.978 +test filename-9.26 {Tcl_JoinPath: mac} {testsetplatform} {
1.979 + testsetplatform mac
1.980 + set res {}
1.981 + lappend res \
1.982 + [file join {:foo:bar}] \
1.983 + [file join drive: {:foo:bar}] \
1.984 + [file join drive: drive: {:foo:bar}]
1.985 + string map [list drive: ""] $res
1.986 +} {:foo:bar foo:bar foo:bar}
1.987 +
1.988 +test filename-10.1 {Tcl_TranslateFileName} {testsetplatform} {
1.989 + testsetplatform unix
1.990 + list [catch {testtranslatefilename foo} msg] $msg
1.991 +} {0 foo}
1.992 +test filename-10.2 {Tcl_TranslateFileName} {testsetplatform} {
1.993 + testsetplatform windows
1.994 + list [catch {testtranslatefilename {c:/foo}} msg] $msg
1.995 +} {0 {c:\foo}}
1.996 +test filename-10.3 {Tcl_TranslateFileName} {testsetplatform} {
1.997 + testsetplatform windows
1.998 + list [catch {testtranslatefilename {c:/\\foo/}} msg] $msg
1.999 +} {0 {c:\foo}}
1.1000 +test filename-10.4 {Tcl_TranslateFileName} {testsetplatform} {
1.1001 + testsetplatform mac
1.1002 + list [catch {testtranslatefilename foo} msg] $msg
1.1003 +} {0 :foo}
1.1004 +test filename-10.5 {Tcl_TranslateFileName} {testsetplatform} {
1.1005 + testsetplatform mac
1.1006 + list [catch {testtranslatefilename :~foo} msg] $msg
1.1007 +} {0 :~foo}
1.1008 +test filename-10.6 {Tcl_TranslateFileName} {testsetplatform} {
1.1009 + global env
1.1010 + set temp $env(HOME)
1.1011 + set env(HOME) "/home/test"
1.1012 + testsetplatform unix
1.1013 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1014 + set env(HOME) $temp
1.1015 + set result
1.1016 +} {0 /home/test/foo}
1.1017 +test filename-10.7 {Tcl_TranslateFileName} {testsetplatform} {
1.1018 + global env
1.1019 + set temp $env(HOME)
1.1020 + unset env(HOME)
1.1021 + testsetplatform unix
1.1022 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1023 + set env(HOME) $temp
1.1024 + set result
1.1025 +} {1 {couldn't find HOME environment variable to expand path}}
1.1026 +test filename-10.8 {Tcl_TranslateFileName} {testsetplatform} {
1.1027 + global env
1.1028 + set temp $env(HOME)
1.1029 + set env(HOME) "/home/test"
1.1030 + testsetplatform unix
1.1031 + set result [list [catch {testtranslatefilename ~} msg] $msg]
1.1032 + set env(HOME) $temp
1.1033 + set result
1.1034 +} {0 /home/test}
1.1035 +test filename-10.9 {Tcl_TranslateFileName} {testsetplatform} {
1.1036 + global env
1.1037 + set temp $env(HOME)
1.1038 + set env(HOME) "/home/test/"
1.1039 + testsetplatform unix
1.1040 + set result [list [catch {testtranslatefilename ~} msg] $msg]
1.1041 + set env(HOME) $temp
1.1042 + set result
1.1043 +} {0 /home/test}
1.1044 +test filename-10.10 {Tcl_TranslateFileName} {testsetplatform} {
1.1045 + global env
1.1046 + set temp $env(HOME)
1.1047 + set env(HOME) "/home/test/"
1.1048 + testsetplatform unix
1.1049 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1050 + set env(HOME) $temp
1.1051 + set result
1.1052 +} {0 /home/test/foo}
1.1053 +test filename-10.11 {Tcl_TranslateFileName} {testsetplatform} {
1.1054 + global env
1.1055 + set temp $env(HOME)
1.1056 + set env(HOME) "Root:"
1.1057 + testsetplatform mac
1.1058 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1059 + set env(HOME) $temp
1.1060 + set result
1.1061 +} {0 Root:foo}
1.1062 +test filename-10.12 {Tcl_TranslateFileName} {testsetplatform} {
1.1063 + global env
1.1064 + set temp $env(HOME)
1.1065 + set env(HOME) "Root:home"
1.1066 + testsetplatform mac
1.1067 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1068 + set env(HOME) $temp
1.1069 + set result
1.1070 +} {0 Root:home:foo}
1.1071 +test filename-10.13 {Tcl_TranslateFileName} {testsetplatform} {
1.1072 + global env
1.1073 + set temp $env(HOME)
1.1074 + set env(HOME) "Root:home"
1.1075 + testsetplatform mac
1.1076 + set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
1.1077 + set env(HOME) $temp
1.1078 + set result
1.1079 +} {0 Root:home::foo}
1.1080 +test filename-10.14 {Tcl_TranslateFileName} {testsetplatform} {
1.1081 + global env
1.1082 + set temp $env(HOME)
1.1083 + set env(HOME) "Root:home"
1.1084 + testsetplatform mac
1.1085 + set result [list [catch {testtranslatefilename ~} msg] $msg]
1.1086 + set env(HOME) $temp
1.1087 + set result
1.1088 +} {0 Root:home}
1.1089 +test filename-10.15 {Tcl_TranslateFileName} {testsetplatform} {
1.1090 + global env
1.1091 + set temp $env(HOME)
1.1092 + set env(HOME) "Root:home:"
1.1093 + testsetplatform mac
1.1094 + set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
1.1095 + set env(HOME) $temp
1.1096 + set result
1.1097 +} {0 Root:home::foo}
1.1098 +test filename-10.16 {Tcl_TranslateFileName} {testsetplatform} {
1.1099 + global env
1.1100 + set temp $env(HOME)
1.1101 + set env(HOME) "Root:home::"
1.1102 + testsetplatform mac
1.1103 + set result [list [catch {testtranslatefilename ~::foo} msg] $msg]
1.1104 + set env(HOME) $temp
1.1105 + set result
1.1106 +} {0 Root:home:::foo}
1.1107 +test filename-10.17 {Tcl_TranslateFileName} {testsetplatform} {
1.1108 + global env
1.1109 + set temp $env(HOME)
1.1110 + set env(HOME) "\\home\\"
1.1111 + testsetplatform windows
1.1112 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1113 + set env(HOME) $temp
1.1114 + set result
1.1115 +} {0 {\home\foo}}
1.1116 +test filename-10.18 {Tcl_TranslateFileName} {testsetplatform} {
1.1117 + global env
1.1118 + set temp $env(HOME)
1.1119 + set env(HOME) "\\home\\"
1.1120 + testsetplatform windows
1.1121 + set result [list [catch {testtranslatefilename ~/foo\\bar} msg] $msg]
1.1122 + set env(HOME) $temp
1.1123 + set result
1.1124 +} {0 {\home\foo\bar}}
1.1125 +test filename-10.19 {Tcl_TranslateFileName} {testsetplatform} {
1.1126 + global env
1.1127 + set temp $env(HOME)
1.1128 + set env(HOME) "c:"
1.1129 + testsetplatform windows
1.1130 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1131 + set env(HOME) $temp
1.1132 + set result
1.1133 +} {0 c:foo}
1.1134 +test filename-10.20 {Tcl_TranslateFileName} {testtranslatefilename} {
1.1135 + list [catch {testtranslatefilename ~blorp/foo} msg] $msg
1.1136 +} {1 {user "blorp" doesn't exist}}
1.1137 +test filename-10.21 {Tcl_TranslateFileName} {testsetplatform} {
1.1138 + global env
1.1139 + set temp $env(HOME)
1.1140 + set env(HOME) "c:\\"
1.1141 + testsetplatform windows
1.1142 + set result [list [catch {testtranslatefilename ~/foo} msg] $msg]
1.1143 + set env(HOME) $temp
1.1144 + set result
1.1145 +} {0 {c:\foo}}
1.1146 +test filename-10.22 {Tcl_TranslateFileName} {testsetplatform} {
1.1147 + testsetplatform windows
1.1148 + list [catch {testtranslatefilename foo//bar} msg] $msg
1.1149 +} {0 {foo\bar}}
1.1150 +
1.1151 +if {[tcltest::testConstraint testsetplatform]} {
1.1152 + testsetplatform $platform
1.1153 +}
1.1154 +
1.1155 +test filename-10.23 {Tcl_TranslateFileName} {unixOnly nonPortable} {
1.1156 + # this test fails if ~ouster is not /home/ouster
1.1157 + list [catch {testtranslatefilename ~ouster} msg] $msg
1.1158 +} {0 /home/ouster}
1.1159 +test filename-10.24 {Tcl_TranslateFileName} {unixOnly nonPortable} {
1.1160 + # this test fails if ~ouster is not /home/ouster
1.1161 + list [catch {testtranslatefilename ~ouster/foo} msg] $msg
1.1162 +} {0 /home/ouster/foo}
1.1163 +
1.1164 +
1.1165 +test filename-11.1 {Tcl_GlobCmd} {
1.1166 + list [catch {glob} msg] $msg
1.1167 +} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
1.1168 +test filename-11.2 {Tcl_GlobCmd} {
1.1169 + list [catch {glob -gorp} msg] $msg
1.1170 +} {1 {bad option "-gorp": must be -directory, -join, -nocomplain, -path, -tails, -types, or --}}
1.1171 +test filename-11.3 {Tcl_GlobCmd} {
1.1172 + list [catch {glob -nocomplai} msg] $msg
1.1173 +} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
1.1174 +test filename-11.4 {Tcl_GlobCmd} {
1.1175 + list [catch {glob -nocomplain} msg] $msg
1.1176 +} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
1.1177 +test filename-11.5 {Tcl_GlobCmd} {
1.1178 + list [catch {glob -nocomplain ~xyqrszzz} msg] $msg
1.1179 +} {0 {}}
1.1180 +test filename-11.6 {Tcl_GlobCmd} {
1.1181 + list [catch {glob ~xyqrszzz} msg] $msg
1.1182 +} {1 {user "xyqrszzz" doesn't exist}}
1.1183 +test filename-11.7 {Tcl_GlobCmd} {
1.1184 + list [catch {glob -- -nocomplain} msg] $msg
1.1185 +} {1 {no files matched glob pattern "-nocomplain"}}
1.1186 +test filename-11.8 {Tcl_GlobCmd} {
1.1187 + list [catch {glob -nocomplain -- -nocomplain} msg] $msg
1.1188 +} {0 {}}
1.1189 +test filename-11.9 {Tcl_GlobCmd} {testsetplatform} {
1.1190 + testsetplatform unix
1.1191 + list [catch {glob ~\\xyqrszzz/bar} msg] $msg
1.1192 +} {1 {user "\xyqrszzz" doesn't exist}}
1.1193 +test filename-11.10 {Tcl_GlobCmd} {testsetplatform} {
1.1194 + testsetplatform unix
1.1195 + list [catch {glob -nocomplain ~\\xyqrszzz/bar} msg] $msg
1.1196 +} {0 {}}
1.1197 +test filename-11.11 {Tcl_GlobCmd} {testsetplatform} {
1.1198 + testsetplatform unix
1.1199 + list [catch {glob ~xyqrszzz\\/\\bar} msg] $msg
1.1200 +} {1 {user "xyqrszzz" doesn't exist}}
1.1201 +test filename-11.12 {Tcl_GlobCmd} {testsetplatform} {
1.1202 + testsetplatform unix
1.1203 + set home $env(HOME)
1.1204 + unset env(HOME)
1.1205 + set x [list [catch {glob ~/*} msg] $msg]
1.1206 + set env(HOME) $home
1.1207 + set x
1.1208 +} {1 {couldn't find HOME environment variable to expand path}}
1.1209 +
1.1210 +if {[tcltest::testConstraint testsetplatform]} {
1.1211 + testsetplatform $platform
1.1212 +}
1.1213 +
1.1214 +test filename-11.13 {Tcl_GlobCmd} {
1.1215 + list [catch {file join [lindex [glob ~] 0]} msg] $msg
1.1216 +} [list 0 [file join $env(HOME)]]
1.1217 +
1.1218 +set oldpwd [pwd]
1.1219 +set oldhome $env(HOME)
1.1220 +cd [temporaryDirectory]
1.1221 +set env(HOME) [pwd]
1.1222 +file delete -force globTest
1.1223 +file mkdir globTest/a1/b1
1.1224 +file mkdir globTest/a1/b2
1.1225 +file mkdir globTest/a2/b3
1.1226 +file mkdir globTest/a3
1.1227 +close [open globTest/x1.c w]
1.1228 +close [open globTest/y1.c w]
1.1229 +close [open globTest/z1.c w]
1.1230 +close [open "globTest/weird name.c" w]
1.1231 +close [open globTest/a1/b1/x2.c w]
1.1232 +close [open globTest/a1/b2/y2.c w]
1.1233 +
1.1234 +catch {close [open globTest/.1 w]}
1.1235 +catch {close [open globTest/x,z1.c w]}
1.1236 +
1.1237 +test filename-11.14 {Tcl_GlobCmd} {
1.1238 + list [catch {glob ~/globTest} msg] $msg
1.1239 +} [list 0 [list [file join $env(HOME) globTest]]]
1.1240 +test filename-11.15 {Tcl_GlobCmd} {
1.1241 + list [catch {glob ~\\/globTest} msg] $msg
1.1242 +} [list 0 [list [file join $env(HOME) globTest]]]
1.1243 +test filename-11.16 {Tcl_GlobCmd} {
1.1244 + list [catch {glob globTest} msg] $msg
1.1245 +} {0 globTest}
1.1246 +
1.1247 +set globname "globTest"
1.1248 +set horribleglobname "glob\[\{Test"
1.1249 +
1.1250 +test filename-11.17 {Tcl_GlobCmd} {unixOnly} {
1.1251 + list [catch {lsort [glob -directory $globname *]} msg] $msg
1.1252 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1253 + [file join $globname a3]\
1.1254 + [file join $globname "weird name.c"]\
1.1255 + [file join $globname x,z1.c]\
1.1256 + [file join $globname x1.c]\
1.1257 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1258 +test filename-11.17.1 {Tcl_GlobCmd} {pcOnly macOnly} {
1.1259 + list [catch {lsort [glob -directory $globname *]} msg] $msg
1.1260 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1261 + [file join $globname .1]\
1.1262 + [file join $globname a3]\
1.1263 + [file join $globname "weird name.c"]\
1.1264 + [file join $globname x,z1.c]\
1.1265 + [file join $globname x1.c]\
1.1266 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1267 +if {[string equal $tcl_platform(platform) "windows"]} {
1.1268 + if {[string index $tcl_platform(osVersion) 0] >= 5 \
1.1269 + && ([lindex [file system [temporaryDirectory]] 1] == "NTFS")} {
1.1270 + tcltest::testConstraint linkDirectory 1
1.1271 + } else {
1.1272 + tcltest::testConstraint linkDirectory 0
1.1273 + }
1.1274 +} elseif {[string equal $tcl_platform(osSystemName) "Symbian"]} {
1.1275 + tcltest::testConstraint linkDirectory 0
1.1276 +} else {
1.1277 + tcltest::testConstraint linkDirectory 1
1.1278 +}
1.1279 +if {[string equal $tcl_platform(platform) "windows"] || [string equal $tcl_platform(osSystemName) "Symbian"]} {
1.1280 + tcltest::testConstraint symbolicLinkFile 0
1.1281 +} else {
1.1282 + tcltest::testConstraint symbolicLinkFile 1
1.1283 +}
1.1284 +test filename-11.17.2 {Tcl_GlobCmd} {notRoot linkDirectory} {
1.1285 + set dir [pwd]
1.1286 + set ret "error in test"
1.1287 + if {[catch {
1.1288 + cd $globname
1.1289 + file link -symbolic link a1
1.1290 + cd $dir
1.1291 + set ret [list [catch {
1.1292 + lsort [glob -directory $globname -join * b1]
1.1293 + } msg] $msg]
1.1294 + }]} {
1.1295 + cd $dir
1.1296 + }
1.1297 + file delete [file join $globname link]
1.1298 + set ret
1.1299 +} [list 0 [lsort [list [file join $globname a1 b1] \
1.1300 + [file join $globname link b1]]]]
1.1301 +# Simpler version of the above test to illustrate a given bug.
1.1302 +test filename-11.17.3 {Tcl_GlobCmd} {notRoot linkDirectory} {
1.1303 + set dir [pwd]
1.1304 + set ret "error in test"
1.1305 + if {[catch {
1.1306 + cd $globname
1.1307 + file link -symbolic link a1
1.1308 + cd $dir
1.1309 + set ret [list [catch {
1.1310 + lsort [glob -directory $globname -type d *]
1.1311 + } msg] $msg]
1.1312 + }]} {
1.1313 + cd $dir
1.1314 + }
1.1315 + file delete [file join $globname link]
1.1316 + set ret
1.1317 +} [list 0 [lsort [list [file join $globname a1] \
1.1318 + [file join $globname a2] \
1.1319 + [file join $globname a3] \
1.1320 + [file join $globname link]]]]
1.1321 +# Make sure the bugfix isn't too simple. We don't want
1.1322 +# to break 'glob -type l'.
1.1323 +test filename-11.17.4 {Tcl_GlobCmd} {notRoot linkDirectory} {
1.1324 + set dir [pwd]
1.1325 + set ret "error in test"
1.1326 + if {[catch {
1.1327 + cd $globname
1.1328 + file link -symbolic link a1
1.1329 + cd $dir
1.1330 + set ret [list [catch {
1.1331 + lsort [glob -directory $globname -type l *]
1.1332 + } msg] $msg]
1.1333 + }]} {
1.1334 + cd $dir
1.1335 + }
1.1336 + file delete [file join $globname link]
1.1337 + set ret
1.1338 +} [list 0 [list [file join $globname link]]]
1.1339 +test filename-11.17.5 {Tcl_GlobCmd} {
1.1340 + list [catch {lsort [glob -directory $globname -tails *.c]} msg] $msg
1.1341 +} [list 0 [lsort [list "weird name.c" x,z1.c x1.c y1.c z1.c]]]
1.1342 +test filename-11.17.6 {Tcl_GlobCmd} {
1.1343 + list [catch {lsort [glob -directory $globname -tails *.c *.c]} msg] $msg
1.1344 +} [list 0 [lsort [concat [list "weird name.c" x,z1.c x1.c y1.c z1.c] \
1.1345 + [list "weird name.c" x,z1.c x1.c y1.c z1.c]]]]
1.1346 +test filename-11.17.7 {Tcl_GlobCmd: broken link and glob -l} {linkDirectory} {
1.1347 + set dir [pwd]
1.1348 + set ret "error in test"
1.1349 + if {[catch {
1.1350 + cd $globname
1.1351 + file mkdir nonexistent
1.1352 + file link -symbolic link nonexistent
1.1353 + file delete nonexistent
1.1354 + cd $dir
1.1355 + set ret [list [catch {
1.1356 + lsort [glob -nocomplain -directory $globname -type l *]
1.1357 + } msg] $msg]
1.1358 + }]} {
1.1359 + cd $dir
1.1360 + }
1.1361 + file delete [file join $globname link]
1.1362 + set ret
1.1363 +} [list 0 [list [file join $globname link]]]
1.1364 +test filename-11.17.8 {Tcl_GlobCmd: broken link and glob -l} {symbolicLinkFile} {
1.1365 + set dir [pwd]
1.1366 + set ret "error in test"
1.1367 + if {[catch {
1.1368 + cd $globname
1.1369 + close [open "nonexistent" w]
1.1370 + file link -symbolic link nonexistent
1.1371 + file delete nonexistent
1.1372 + cd $dir
1.1373 + set ret [list [catch {
1.1374 + lsort [glob -nocomplain -directory $globname -type l *]
1.1375 + } msg] $msg]
1.1376 + }]} {
1.1377 + cd $dir
1.1378 + }
1.1379 + file delete [file join $globname link]
1.1380 + set ret
1.1381 +} [list 0 [list [file join $globname link]]]
1.1382 +test filename-11.18 {Tcl_GlobCmd} {unixOnly} {
1.1383 + list [catch {lsort [glob -path $globname/ *]} msg] $msg
1.1384 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1385 + [file join $globname a3]\
1.1386 + [file join $globname "weird name.c"]\
1.1387 + [file join $globname x,z1.c]\
1.1388 + [file join $globname x1.c]\
1.1389 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1390 +test filename-11.18.1 {Tcl_GlobCmd} {pcOnly macOnly} {
1.1391 + list [catch {lsort [glob -path $globname/ *]} msg] $msg
1.1392 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1393 + [file join $globname .1]\
1.1394 + [file join $globname a3]\
1.1395 + [file join $globname "weird name.c"]\
1.1396 + [file join $globname x,z1.c]\
1.1397 + [file join $globname x1.c]\
1.1398 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1399 +test filename-11.19 {Tcl_GlobCmd} {unixOnly} {
1.1400 + list [catch {lsort [glob -join -path \
1.1401 + [string range $globname 0 5] * *]} msg] $msg
1.1402 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1403 + [file join $globname a3]\
1.1404 + [file join $globname "weird name.c"]\
1.1405 + [file join $globname x,z1.c]\
1.1406 + [file join $globname x1.c]\
1.1407 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1408 +test filename-11.19.1 {Tcl_GlobCmd} {pcOnly macOnly} {
1.1409 + list [catch {lsort [glob -join -path \
1.1410 + [string range $globname 0 5] * *]} msg] $msg
1.1411 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1412 + [file join $globname .1]\
1.1413 + [file join $globname a3]\
1.1414 + [file join $globname "weird name.c"]\
1.1415 + [file join $globname x,z1.c]\
1.1416 + [file join $globname x1.c]\
1.1417 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1418 +test filename-11.20 {Tcl_GlobCmd} {
1.1419 + list [catch {lsort [glob -type d -dir $globname *]} msg] $msg
1.1420 +} [list 0 [lsort [list [file join $globname a1]\
1.1421 + [file join $globname a2]\
1.1422 + [file join $globname a3]]]]
1.1423 +test filename-11.21 {Tcl_GlobCmd} {
1.1424 + list [catch {lsort [glob -type d -path $globname *]} msg] $msg
1.1425 +} [list 0 [lsort [list $globname]]]
1.1426 +
1.1427 +test filename-11.21.1 {Tcl_GlobCmd} {
1.1428 + close [open {[tcl].testremains} w]
1.1429 + set res [list [catch {lsort [glob -path {[tcl]} *]} msg] $msg]
1.1430 + file delete -force {[tcl].testremains}
1.1431 + set res
1.1432 +} [list 0 {{[tcl].testremains}}]
1.1433 +
1.1434 +# Get rid of file/dir if it exists, since it will have
1.1435 +# been left behind by a previous failed run.
1.1436 +if {[file exists $horribleglobname]} {
1.1437 + file delete -force $horribleglobname
1.1438 +}
1.1439 +file rename globTest $horribleglobname
1.1440 +set globname $horribleglobname
1.1441 +
1.1442 +test filename-11.22 {Tcl_GlobCmd} {unixOnly} {
1.1443 + list [catch {lsort [glob -dir $globname *]} msg] $msg
1.1444 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1445 + [file join $globname a3]\
1.1446 + [file join $globname "weird name.c"]\
1.1447 + [file join $globname x,z1.c]\
1.1448 + [file join $globname x1.c]\
1.1449 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1450 +test filename-11.22.1 {Tcl_GlobCmd} {pcOnly macOnly} {
1.1451 + list [catch {lsort [glob -dir $globname *]} msg] $msg
1.1452 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1453 + [file join $globname .1]\
1.1454 + [file join $globname a3]\
1.1455 + [file join $globname "weird name.c"]\
1.1456 + [file join $globname x,z1.c]\
1.1457 + [file join $globname x1.c]\
1.1458 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1459 +test filename-11.23 {Tcl_GlobCmd} {unixOnly} {
1.1460 + list [catch {lsort [glob -path $globname/ *]} msg] $msg
1.1461 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1462 + [file join $globname a3]\
1.1463 + [file join $globname "weird name.c"]\
1.1464 + [file join $globname x,z1.c]\
1.1465 + [file join $globname x1.c]\
1.1466 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1467 +test filename-11.23.1 {Tcl_GlobCmd} {pcOnly macOnly} {
1.1468 + list [catch {lsort [glob -path $globname/ *]} msg] $msg
1.1469 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1470 + [file join $globname .1]\
1.1471 + [file join $globname a3]\
1.1472 + [file join $globname "weird name.c"]\
1.1473 + [file join $globname x,z1.c]\
1.1474 + [file join $globname x1.c]\
1.1475 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1476 +test filename-11.24 {Tcl_GlobCmd} {unixOnly} {
1.1477 + list [catch {lsort [glob -join -path \
1.1478 + [string range $globname 0 5] * *]} msg] $msg
1.1479 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1480 + [file join $globname a3]\
1.1481 + [file join $globname "weird name.c"]\
1.1482 + [file join $globname x,z1.c]\
1.1483 + [file join $globname x1.c]\
1.1484 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1485 +test filename-11.24.1 {Tcl_GlobCmd} {pcOnly macOnly} {
1.1486 + list [catch {lsort [glob -join -path \
1.1487 + [string range $globname 0 5] * *]} msg] $msg
1.1488 +} [list 0 [lsort [list [file join $globname a1] [file join $globname a2]\
1.1489 + [file join $globname .1]\
1.1490 + [file join $globname a3]\
1.1491 + [file join $globname "weird name.c"]\
1.1492 + [file join $globname x,z1.c]\
1.1493 + [file join $globname x1.c]\
1.1494 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1495 +test filename-11.25 {Tcl_GlobCmd} {
1.1496 + list [catch {lsort [glob -type d -dir $globname *]} msg] $msg
1.1497 +} [list 0 [lsort [list [file join $globname a1]\
1.1498 + [file join $globname a2]\
1.1499 + [file join $globname a3]]]]
1.1500 +test filename-11.25.1 {Tcl_GlobCmd} {
1.1501 + list [catch {lsort [glob -type {d r} -dir $globname *]} msg] $msg
1.1502 +} [list 0 [lsort [list [file join $globname a1]\
1.1503 + [file join $globname a2]\
1.1504 + [file join $globname a3]]]]
1.1505 +test filename-11.25.2 {Tcl_GlobCmd} {
1.1506 + list [catch {lsort [glob -type {d r w} -dir $globname *]} msg] $msg
1.1507 +} [list 0 [lsort [list [file join $globname a1]\
1.1508 + [file join $globname a2]\
1.1509 + [file join $globname a3]]]]
1.1510 +test filename-11.26 {Tcl_GlobCmd} {
1.1511 + list [catch {glob -type d -path $globname *} msg] $msg
1.1512 +} [list 0 [list $globname]]
1.1513 +test filename-11.27 {Tcl_GlobCmd} {
1.1514 + list [catch {glob -types abcde *} msg] $msg
1.1515 +} {1 {bad argument to "-types": abcde}}
1.1516 +test filename-11.28 {Tcl_GlobCmd} {
1.1517 + list [catch {glob -types z *} msg] $msg
1.1518 +} {1 {bad argument to "-types": z}}
1.1519 +test filename-11.29 {Tcl_GlobCmd} {
1.1520 + list [catch {glob -types {abcd efgh} *} msg] $msg
1.1521 +} {1 {only one MacOS type or creator argument to "-types" allowed}}
1.1522 +test filename-11.30 {Tcl_GlobCmd} {
1.1523 + list [catch {glob -types {{macintosh type TEXT} \
1.1524 + {macintosh creator ALFA} efgh} *} msg] $msg
1.1525 +} {1 {only one MacOS type or creator argument to "-types" allowed}}
1.1526 +test filename-11.31 {Tcl_GlobCmd} {
1.1527 + list [catch {glob -types} msg] $msg
1.1528 +} {1 {missing argument to "-types"}}
1.1529 +test filename-11.32 {Tcl_GlobCmd} {
1.1530 + list [catch {glob -path hello -dir hello *} msg] $msg
1.1531 +} {1 {"-directory" cannot be used with "-path"}}
1.1532 +test filename-11.33 {Tcl_GlobCmd} {
1.1533 + list [catch {glob -path} msg] $msg
1.1534 +} {1 {missing argument to "-path"}}
1.1535 +test filename-11.34 {Tcl_GlobCmd} {
1.1536 + list [catch {glob -direct} msg] $msg
1.1537 +} {1 {missing argument to "-directory"}}
1.1538 +test filename-11.35 {Tcl_GlobCmd} {
1.1539 + list [catch {glob -paths *} msg] $msg
1.1540 +} {1 {bad option "-paths": must be -directory, -join, -nocomplain, -path, -tails, -types, or --}}
1.1541 +# Test '-tails' flag to glob.
1.1542 +test filename-11.36 {Tcl_GlobCmd} {
1.1543 + list [catch {glob -tails *} msg] $msg
1.1544 +} {1 {"-tails" must be used with either "-directory" or "-path"}}
1.1545 +test filename-11.37 {Tcl_GlobCmd} {
1.1546 + list [catch {glob -type d -tails -path $globname *} msg] $msg
1.1547 +} [list 0 [list $globname]]
1.1548 +test filename-11.38 {Tcl_GlobCmd} {
1.1549 + list [catch {glob -tails -path $globname *} msg] $msg
1.1550 +} [list 0 [list $globname]]
1.1551 +test filename-11.39 {Tcl_GlobCmd} {
1.1552 + list [catch {glob -tails -join -path $globname *} msg] $msg
1.1553 +} [list 0 [list $globname]]
1.1554 +test filename-11.40 {Tcl_GlobCmd} {
1.1555 + expr {[glob -dir [pwd] -tails *] == [glob *]}
1.1556 +} {1}
1.1557 +test filename-11.41 {Tcl_GlobCmd} {
1.1558 + expr {[glob -dir [pwd] -tails *] != [glob -dir [pwd] *]}
1.1559 +} {1}
1.1560 +test filename-11.42 {Tcl_GlobCmd} {
1.1561 + set res [list]
1.1562 + foreach f [glob -dir [pwd] *] {
1.1563 + lappend res [file tail $f]
1.1564 + }
1.1565 + expr {$res == [glob *]}
1.1566 +} {1}
1.1567 +test filename-11.43 {Tcl_GlobCmd} {
1.1568 + list [catch {glob -t *} msg] $msg
1.1569 +} {1 {ambiguous option "-t": must be -directory, -join, -nocomplain, -path, -tails, -types, or --}}
1.1570 +test filename-11.44 {Tcl_GlobCmd} {
1.1571 + list [catch {glob -tails -path hello -directory hello *} msg] $msg
1.1572 +} {1 {"-directory" cannot be used with "-path"}}
1.1573 +test filename-11.45 {Tcl_GlobCmd on root volume} {
1.1574 + set res1 ""
1.1575 + set res2 ""
1.1576 + catch {
1.1577 + set res1 [glob -dir [lindex [file volumes] 0] -tails *]
1.1578 + }
1.1579 + catch {
1.1580 + set tmpd [pwd]
1.1581 + cd [lindex [file volumes] 0]
1.1582 + set res2 [glob *]
1.1583 + cd $tmpd
1.1584 + }
1.1585 + expr {$res1 == $res2}
1.1586 +} {1}
1.1587 +test filename-11.46 {Tcl_GlobCmd} {
1.1588 + list [catch {glob -types abcde -dir foo *} msg] $msg
1.1589 +} {1 {bad argument to "-types": abcde}}
1.1590 +test filename-11.47 {Tcl_GlobCmd} {
1.1591 + list [catch {glob -types abcde -path foo *} msg] $msg
1.1592 +} {1 {bad argument to "-types": abcde}}
1.1593 +test filename-11.48 {Tcl_GlobCmd} {
1.1594 + list [catch {glob -types abcde -dir foo -join * *} msg] $msg
1.1595 +} {1 {bad argument to "-types": abcde}}
1.1596 +test filename-11.49 {Tcl_GlobCmd} {
1.1597 + list [catch {glob -types abcde -path foo -join * *} msg] $msg
1.1598 +} {1 {bad argument to "-types": abcde}}
1.1599 +
1.1600 +file rename $horribleglobname globTest
1.1601 +set globname globTest
1.1602 +unset horribleglobname
1.1603 +
1.1604 +test filename-12.1 {simple globbing} {unixOrPc} {
1.1605 + list [catch {glob {}} msg] $msg
1.1606 +} {0 .}
1.1607 +test filename-12.1.1 {simple globbing} {unixOrPc} {
1.1608 + list [catch {glob -types f {}} msg] $msg
1.1609 +} {1 {no files matched glob pattern ""}}
1.1610 +test filename-12.1.2 {simple globbing} {unixOrPc} {
1.1611 + list [catch {glob -types d {}} msg] $msg
1.1612 +} {0 .}
1.1613 +test filename-12.1.3 {simple globbing} {unixOnly} {
1.1614 + list [catch {glob -types hidden {}} msg] $msg
1.1615 +} {0 .}
1.1616 +test filename-12.1.4 {simple globbing} {pcOnly} {
1.1617 + list [catch {glob -types hidden {}} msg] $msg
1.1618 +} {1 {no files matched glob pattern ""}}
1.1619 +test filename-12.1.5 {simple globbing} {pcOnly} {
1.1620 + list [catch {glob -types hidden c:/} msg] $msg
1.1621 +} {1 {no files matched glob pattern "c:/"}}
1.1622 +test filename-12.1.6 {simple globbing} {pcOnly} {
1.1623 + list [catch {glob c:/} msg] $msg
1.1624 +} {0 c:/}
1.1625 +test filename-12.2 {simple globbing} {macOnly} {
1.1626 + list [catch {glob {}} msg] $msg
1.1627 +} {0 :}
1.1628 +test filename-12.2.1 {simple globbing} {macOnly} {
1.1629 + list [catch {glob -types f {}} msg] $msg
1.1630 +} {1 {no files matched glob pattern ""}}
1.1631 +test filename-12.2.2 {simple globbing} {macOnly} {
1.1632 + list [catch {glob -types d {}} msg] $msg
1.1633 +} {0 :}
1.1634 +test filename-12.2.3 {simple globbing} {macOnly} {
1.1635 + list [catch {glob -types hidden {}} msg] $msg
1.1636 +} {1 {no files matched glob pattern ""}}
1.1637 +test filename-12.3 {simple globbing} {
1.1638 + list [catch {glob -nocomplain \{a1,a2\}} msg] $msg
1.1639 +} {0 {}}
1.1640 +
1.1641 +if {$tcl_platform(platform) == "macintosh"} {
1.1642 + set globPreResult :globTest:
1.1643 +} else {
1.1644 + set globPreResult globTest/
1.1645 +}
1.1646 +set x1 x1.c
1.1647 +set y1 y1.c
1.1648 +test filename-12.4 {simple globbing} {unixOrPc} {
1.1649 + lsort [glob globTest/x1.c globTest/y1.c globTest/foo]
1.1650 +} "$globPreResult$x1 $globPreResult$y1"
1.1651 +test filename-12.5 {simple globbing} {
1.1652 + list [catch {glob globTest\\/x1.c} msg] $msg
1.1653 +} "0 $globPreResult$x1"
1.1654 +test filename-12.6 {simple globbing} {
1.1655 + list [catch {glob globTest\\/\\x1.c} msg] $msg
1.1656 +} "0 $globPreResult$x1"
1.1657 +test filename-12.7 {globbing at filesystem root} {unixOnly} {
1.1658 + set res1 [glob -nocomplain /*]
1.1659 + set res2 [glob -path / *]
1.1660 + set equal [string equal $res1 $res2]
1.1661 + if {!$equal} {
1.1662 + lappend equal "not equal" $res1 $res2
1.1663 + }
1.1664 + set equal
1.1665 +} {1}
1.1666 +test filename-12.8 {globbing at filesystem root} {unixOnly} {
1.1667 + set dir [lindex [glob -type d /*] 0]
1.1668 + set first [string range $dir 0 1]
1.1669 + set res1 [glob -nocomplain ${first}*]
1.1670 + set res2 [glob -path $first *]
1.1671 + set equal [string equal $res1 $res2]
1.1672 + if {!$equal} {
1.1673 + lappend equal "not equal" $res1 $res2
1.1674 + }
1.1675 + set equal
1.1676 +} {1}
1.1677 +test filename-12.9 {globbing at filesystem root} {winOnly} {
1.1678 + # Can't grab just anything from 'file volumes' because we need a dir
1.1679 + # that has subdirs - assume that C:/ exists across Windows machines.
1.1680 + set dir [lindex [glob -type d C:/*] 0]
1.1681 + set first [string range $dir 0 3]
1.1682 + set res1 [glob -nocomplain ${first}*]
1.1683 + set res2 [glob -path $first *]
1.1684 + set equal [string equal $res1 $res2]
1.1685 + if {!$equal} {
1.1686 + lappend equal "not equal" $res1 $res2
1.1687 + }
1.1688 + set equal
1.1689 +} {1}
1.1690 +
1.1691 +test filename-13.1 {globbing with brace substitution} {
1.1692 + list [catch {glob globTest/\{\}} msg] $msg
1.1693 +} "0 $globPreResult"
1.1694 +test filename-13.2 {globbing with brace substitution} {
1.1695 + list [catch {glob globTest/\{} msg] $msg
1.1696 +} {1 {unmatched open-brace in file name}}
1.1697 +test filename-13.3 {globbing with brace substitution} {
1.1698 + list [catch {glob globTest/\{\\\}} msg] $msg
1.1699 +} {1 {unmatched open-brace in file name}}
1.1700 +test filename-13.4 {globbing with brace substitution} {
1.1701 + list [catch {glob globTest/\{\\} msg] $msg
1.1702 +} {1 {unmatched open-brace in file name}}
1.1703 +test filename-13.5 {globbing with brace substitution} {
1.1704 + list [catch {glob globTest/\}} msg] $msg
1.1705 +} {1 {unmatched close-brace in file name}}
1.1706 +test filename-13.6 {globbing with brace substitution} {
1.1707 + list [catch {glob globTest/\{\}x1.c} msg] $msg
1.1708 +} "0 $globPreResult$x1"
1.1709 +test filename-13.7 {globbing with brace substitution} {
1.1710 + list [catch {glob globTest/\{x\}1.c} msg] $msg
1.1711 +} "0 $globPreResult$x1"
1.1712 +test filename-13.8 {globbing with brace substitution} {
1.1713 + list [catch {glob globTest/\{x\{\}\}1.c} msg] $msg
1.1714 +} "0 $globPreResult$x1"
1.1715 +test filename-13.9 {globbing with brace substitution} {
1.1716 + list [lsort [catch {glob globTest/\{x,y\}1.c} msg]] $msg
1.1717 +} [list 0 [list $globPreResult$x1 $globPreResult$y1]]
1.1718 +test filename-13.10 {globbing with brace substitution} {
1.1719 + list [lsort [catch {glob globTest/\{x,,y\}1.c} msg]] $msg
1.1720 +} [list 0 [list $globPreResult$x1 $globPreResult$y1]]
1.1721 +test filename-13.11 {globbing with brace substitution} {unixOrPc} {
1.1722 + list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg
1.1723 +} {0 {globTest/x1.c globTest/x,z1.c globTest/z1.c}}
1.1724 +test filename-13.12 {globbing with brace substitution} {macOnly} {
1.1725 + list [lsort [catch {glob globTest/\{x,x\\,z,z\}1.c} msg]] $msg
1.1726 +} {0 {:globTest:x1.c :globTest:x,z1.c :globTest:z1.c}}
1.1727 +test filename-13.13 {globbing with brace substitution} {
1.1728 + lsort [glob globTest/{a,b,x,y}1.c]
1.1729 +} [list $globPreResult$x1 $globPreResult$y1]
1.1730 +test filename-13.14 {globbing with brace substitution} {unixOrPc} {
1.1731 + lsort [glob {globTest/{x1,y2,weird name}.c}]
1.1732 +} {{globTest/weird name.c} globTest/x1.c}
1.1733 +test filename-13.15 {globbing with brace substitution} {macOnly} {
1.1734 + lsort [glob {globTest/{x1,y2,weird name}.c}]
1.1735 +} {{:globTest:weird name.c} :globTest:x1.c}
1.1736 +test filename-13.16 {globbing with brace substitution} {unixOrPc} {
1.1737 + lsort [glob globTest/{x1.c,a1/*}]
1.1738 +} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}
1.1739 +test filename-13.17 {globbing with brace substitution} {macOnly} {
1.1740 + lsort [glob globTest/{x1.c,a1/*}]
1.1741 +} {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}
1.1742 +test filename-13.18 {globbing with brace substitution} {unixOrPc} {
1.1743 + lsort [glob globTest/{x1.c,{a},a1/*}]
1.1744 +} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}
1.1745 +test filename-13.19 {globbing with brace substitution} {macOnly} {
1.1746 + lsort [glob globTest/{x1.c,{a},a1/*}]
1.1747 +} {:globTest:a1:b1 :globTest:a1:b2 :globTest:x1.c}
1.1748 +test filename-13.20 {globbing with brace substitution} {unixOrPc} {
1.1749 + lsort [glob globTest/{a,x}1/*/{x,y}*]
1.1750 +} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}
1.1751 +test filename-13.21 {globbing with brace substitution} {macOnly} {
1.1752 + lsort [glob globTest/{a,x}1/*/{x,y}*]
1.1753 +} {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}
1.1754 +test filename-13.22 {globbing with brace substitution} {
1.1755 + list [catch {glob globTest/\{a,x\}1/*/\{} msg] $msg
1.1756 +} {1 {unmatched open-brace in file name}}
1.1757 +
1.1758 +test filename-14.1 {asterisks, question marks, and brackets} {unixOrPc} {
1.1759 + lsort [glob glo*/*.c]
1.1760 +} {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}
1.1761 +test filename-14.2 {asterisks, question marks, and brackets} {macOnly} {
1.1762 + lsort [glob glo*/*.c]
1.1763 +} {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}
1.1764 +test filename-14.3 {asterisks, question marks, and brackets} {unixOrPc} {
1.1765 + lsort [glob globTest/?1.c]
1.1766 +} {globTest/x1.c globTest/y1.c globTest/z1.c}
1.1767 +test filename-14.4 {asterisks, question marks, and brackets} {macOnly} {
1.1768 + lsort [glob globTest/?1.c]
1.1769 +} {:globTest:x1.c :globTest:y1.c :globTest:z1.c}
1.1770 +
1.1771 +# The current directory could be anywhere; do this to stop spurious matches
1.1772 +file mkdir globTestContext
1.1773 +file rename globTest [file join globTestContext globTest]
1.1774 +set savepwd [pwd]
1.1775 +cd globTestContext
1.1776 +
1.1777 +test filename-14.5 {asterisks, question marks, and brackets} {unixOrPc} {
1.1778 + lsort [glob */*/*/*.c]
1.1779 +} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}
1.1780 +test filename-14.6 {asterisks, question marks, and brackets} {macOnly} {
1.1781 + lsort [glob */*/*/*.c]
1.1782 +} {:globTest:a1:b1:x2.c :globTest:a1:b2:y2.c}
1.1783 +
1.1784 +# Reset to where we were
1.1785 +cd $savepwd
1.1786 +file rename [file join globTestContext globTest] globTest
1.1787 +file delete globTestContext
1.1788 +
1.1789 +test filename-14.7 {asterisks, question marks, and brackets} {unixOnly} {
1.1790 + lsort [glob globTest/*]
1.1791 +} {globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}
1.1792 +test filename-14.7.1 {asterisks, question marks, and brackets} {pcOnly} {
1.1793 + lsort [glob globTest/*]
1.1794 +} {globTest/.1 globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}
1.1795 +test filename-14.8 {asterisks, question marks, and brackets} {macOnly} {
1.1796 + lsort [glob globTest/*]
1.1797 +} {:globTest:.1 :globTest:a1 :globTest:a2 :globTest:a3 {:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}
1.1798 +test filename-14.9.1 {asterisks, question marks, and brackets} {unixOrPc tempNotSymbian} {
1.1799 + lsort [glob globTest/.*]
1.1800 +} {globTest/. globTest/.. globTest/.1}
1.1801 +test filename-14.9.2 {asterisks, question marks, and brackets} {symbianOnly} {
1.1802 + lsort [glob globTest/.*]
1.1803 +} {globTest/.1}
1.1804 +test filename-14.10 {asterisks, question marks, and brackets} {macOnly} {
1.1805 + lsort [glob globTest/.*]
1.1806 +} {:globTest:.1}
1.1807 +test filename-14.11 {asterisks, question marks, and brackets} {unixOrPc} {
1.1808 + lsort [glob globTest/*/*]
1.1809 +} {globTest/a1/b1 globTest/a1/b2 globTest/a2/b3}
1.1810 +test filename-14.12 {asterisks, question marks, and brackets} {macOnly} {
1.1811 + lsort [glob globTest/*/*]
1.1812 +} {:globTest:a1:b1 :globTest:a1:b2 :globTest:a2:b3}
1.1813 +test filename-14.13 {asterisks, question marks, and brackets} {unixOrPc} {
1.1814 + lsort [glob {globTest/[xyab]1.*}]
1.1815 +} {globTest/x1.c globTest/y1.c}
1.1816 +test filename-14.14 {asterisks, question marks, and brackets} {macOnly} {
1.1817 + lsort [glob {globTest/[xyab]1.*}]
1.1818 +} {:globTest:x1.c :globTest:y1.c}
1.1819 +test filename-14.15 {asterisks, question marks, and brackets} {unixOrPc} {
1.1820 + lsort [glob globTest/*/]
1.1821 +} {globTest/a1/ globTest/a2/ globTest/a3/}
1.1822 +test filename-14.16 {asterisks, question marks, and brackets} {macOnly} {
1.1823 + lsort [glob globTest/*/]
1.1824 +} {:globTest:a1: :globTest:a2: :globTest:a3:}
1.1825 +test filename-14.17 {asterisks, question marks, and brackets} {
1.1826 + global env
1.1827 + set temp $env(HOME)
1.1828 + set env(HOME) [file join $env(HOME) globTest]
1.1829 + set result [list [catch {glob ~/z*} msg] $msg]
1.1830 + set env(HOME) $temp
1.1831 + set result
1.1832 +} [list 0 [list [file join $env(HOME) globTest z1.c]]]
1.1833 +test filename-14.18 {asterisks, question marks, and brackets} {unixOrPc} {
1.1834 + list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
1.1835 +} {0 {{globTest/weird name.c} globTest/x,z1.c globTest/x1.c globTest/y1.c globTest/z1.c}}
1.1836 +test filename-14.19 {asterisks, question marks, and brackets} {macOnly} {
1.1837 + list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
1.1838 +} {0 {{:globTest:weird name.c} :globTest:x,z1.c :globTest:x1.c :globTest:y1.c :globTest:z1.c}}
1.1839 +test filename-14.20 {asterisks, question marks, and brackets} {
1.1840 + list [catch {glob -nocomplain goo/*} msg] $msg
1.1841 +} {0 {}}
1.1842 +test filename-14.21 {asterisks, question marks, and brackets} {
1.1843 + list [catch {glob globTest/*/gorp} msg] $msg
1.1844 +} {1 {no files matched glob pattern "globTest/*/gorp"}}
1.1845 +test filename-14.22 {asterisks, question marks, and brackets} {
1.1846 + list [catch {glob goo/* x*z foo?q} msg] $msg
1.1847 +} {1 {no files matched glob patterns "goo/* x*z foo?q"}}
1.1848 +test filename-14.23 {slash globbing} {unixOrPc} {
1.1849 + glob /
1.1850 +} /
1.1851 +test filename-14.24 {slash globbing} {pcOnly} {
1.1852 + glob {\\}
1.1853 +} /
1.1854 +test filename-14.25 {type specific globbing} {unixOnly} {
1.1855 + list [catch {lsort [glob -dir globTest -types f *]} msg] $msg
1.1856 +} [list 0 [lsort [list \
1.1857 + [file join $globname "weird name.c"]\
1.1858 + [file join $globname x,z1.c]\
1.1859 + [file join $globname x1.c]\
1.1860 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1861 +test filename-14.25.1 {type specific globbing} {pcOnly macOnly} {
1.1862 + list [catch {lsort [glob -dir globTest -types f *]} msg] $msg
1.1863 +} [list 0 [lsort [list \
1.1864 + [file join $globname .1]\
1.1865 + [file join $globname "weird name.c"]\
1.1866 + [file join $globname x,z1.c]\
1.1867 + [file join $globname x1.c]\
1.1868 + [file join $globname y1.c] [file join $globname z1.c]]]]
1.1869 +test filename-14.26 {type specific globbing} {
1.1870 + list [catch {glob -nocomplain -dir globTest -types {readonly} *} msg] $msg
1.1871 +} [list 0 {}]
1.1872 +
1.1873 +unset globname
1.1874 +
1.1875 +# The following tests are only valid for Unix systems.
1.1876 +# On some systems, like AFS, "000" protection doesn't prevent
1.1877 +# access by owner, so the following test is not portable.
1.1878 +
1.1879 +catch {file attributes globTest/a1 -permissions 0000}
1.1880 +test filename-15.1 {unix specific globbing} {unixOnly nonPortable} {
1.1881 + string tolower [list [catch {glob globTest/a1/*} msg] $msg $errorCode]
1.1882 +} {1 {couldn't read directory "globtest/a1": permission denied} {posix eacces {permission denied}}}
1.1883 +test filename-15.2 {unix specific no complain: no errors} {unixOnly nonPortable} {
1.1884 + glob -nocomplain globTest/a1/*
1.1885 +} {}
1.1886 +test filename-15.3 {unix specific no complain: no errors, good result} \
1.1887 + {unixOnly nonPortable} {
1.1888 + # test fails because if an error occur , the interp's result
1.1889 + # is reset...
1.1890 + glob -nocomplain globTest/a2 globTest/a1/* globTest/a3
1.1891 +} {globTest/a2 globTest/a3}
1.1892 +
1.1893 +catch {file attributes globTest/a1 -permissions 0755}
1.1894 +test filename-15.4 {unix specific no complain: no errors, good result} \
1.1895 + {unixOnly nonPortable} {
1.1896 + # test fails because if an error occurs, the interp's result
1.1897 + # is reset... or you don't run at scriptics where the
1.1898 + # outser and welch users exists
1.1899 + glob -nocomplain ~ouster ~foo ~welch
1.1900 +} {/home/ouster /home/welch}
1.1901 +test filename-15.4.1 {no complain: no errors, good result} {
1.1902 + # test used to fail because if an error occurs, the interp's result
1.1903 + # is reset...
1.1904 + string equal [glob -nocomplain ~wontexist ~blah ~] \
1.1905 + [glob -nocomplain ~ ~blah ~wontexist]
1.1906 +} {1}
1.1907 +test filename-15.5 {unix specific globbing} {unixOnly nonPortable} {
1.1908 + glob ~ouster/.csh*
1.1909 +} "/home/ouster/.cshrc"
1.1910 +catch {close [open globTest/odd\\\[\]*?\{\}name w]}
1.1911 +test filename-15.6 {unix specific globbing} {unixOnly tempNotSymbian} {
1.1912 + global env
1.1913 + set temp $env(HOME)
1.1914 + set env(HOME) $env(HOME)/globTest/odd\\\[\]*?\{\}name
1.1915 + set result [list [catch {glob ~} msg] $msg]
1.1916 + set env(HOME) $temp
1.1917 + set result
1.1918 +} [list 0 [list [lindex [glob ~] 0]/globTest/odd\\\[\]*?\{\}name]]
1.1919 +catch {file delete -force globTest/odd\\\[\]*?\{\}name}
1.1920 +
1.1921 +# The following tests are only valid for Windows systems.
1.1922 +set oldDir [pwd]
1.1923 +if {$::tcltest::testConstraints(pcOnly)} {
1.1924 + cd c:/
1.1925 + file delete -force globTest
1.1926 + file mkdir globTest
1.1927 + close [open globTest/x1.BAT w]
1.1928 + close [open globTest/y1.Bat w]
1.1929 + close [open globTest/z1.bat w]
1.1930 +}
1.1931 +
1.1932 +test filename-16.1 {windows specific globbing} {pcOnly} {
1.1933 + lsort [glob globTest/*.bat]
1.1934 +} {globTest/x1.BAT globTest/y1.Bat globTest/z1.bat}
1.1935 +test filename-16.2 {windows specific globbing} {pcOnly} {
1.1936 + glob c:
1.1937 +} c:
1.1938 +test filename-16.3 {windows specific globbing} {pcOnly} {
1.1939 + glob c:\\\\
1.1940 +} c:/
1.1941 +test filename-16.4 {windows specific globbing} {pcOnly} {
1.1942 + glob c:/
1.1943 +} c:/
1.1944 +test filename-16.5 {windows specific globbing} {pcOnly} {
1.1945 + glob c:*bTest
1.1946 +} c:globTest
1.1947 +test filename-16.6 {windows specific globbing} {pcOnly} {
1.1948 + glob c:\\\\*bTest
1.1949 +} c:/globTest
1.1950 +test filename-16.7 {windows specific globbing} {pcOnly} {
1.1951 + glob c:/*bTest
1.1952 +} c:/globTest
1.1953 +test filename-16.8 {windows specific globbing} {pcOnly} {
1.1954 + lsort [glob c:globTest/*.bat]
1.1955 +} {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}
1.1956 +test filename-16.9 {windows specific globbing} {pcOnly} {
1.1957 + lsort [glob c:/globTest/*.bat]
1.1958 +} {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}
1.1959 +test filename-16.10 {windows specific globbing} {pcOnly} {
1.1960 + lsort [glob c:globTest\\\\*.bat]
1.1961 +} {c:globTest/x1.BAT c:globTest/y1.Bat c:globTest/z1.bat}
1.1962 +test filename-16.11 {windows specific globbing} {pcOnly} {
1.1963 + lsort [glob c:\\\\globTest\\\\*.bat]
1.1964 +} {c:/globTest/x1.BAT c:/globTest/y1.Bat c:/globTest/z1.bat}
1.1965 +
1.1966 +# some tests require a shared C drive
1.1967 +
1.1968 +if {[catch {cd //[info hostname]/c}]} {
1.1969 + set ::tcltest::testConstraints(sharedCdrive) 0
1.1970 +} else {
1.1971 + set ::tcltest::testConstraints(sharedCdrive) 1
1.1972 +}
1.1973 +
1.1974 +test filename-16.12 {windows specific globbing} {pcOnly sharedCdrive} {
1.1975 + cd //[info hostname]/c
1.1976 + glob //[info hostname]/c/*Test
1.1977 +} //[info hostname]/c/globTest
1.1978 +test filename-16.13 {windows specific globbing} {pcOnly sharedCdrive} {
1.1979 + cd //[info hostname]/c
1.1980 + glob "\\\\\\\\[info hostname]\\\\c\\\\*Test"
1.1981 +} //[info hostname]/c/globTest
1.1982 +test filename-16.14 {windows specific globbing} {pcOnly} {
1.1983 + cd [lindex [glob -types d -dir C:/ *] 0]
1.1984 + expr {[lsearch -exact [glob {{.,*}*}] ".."] != -1}
1.1985 +} {1}
1.1986 +test filename-16.15 {windows specific globbing} {pcOnly} {
1.1987 + cd [lindex [glob -types d -dir C:/ *] 0]
1.1988 + glob ..
1.1989 +} {..}
1.1990 +test filename-16.16 {windows specific globbing} {pcOnly} {
1.1991 + file tail [lindex [glob "[lindex [glob -types d -dir C:/ *] 0]/.."] 0]
1.1992 +} {..}
1.1993 +
1.1994 +test filename-17.1 {windows specific special files} {testsetplatform} {
1.1995 + testsetplatform win
1.1996 + list [file pathtype com1] [file pathtype con] [file pathtype lpt3] \
1.1997 + [file pathtype prn] [file pathtype nul] [file pathtype aux] \
1.1998 + [file pathtype foo]
1.1999 +} {absolute absolute absolute absolute absolute absolute relative}
1.2000 +
1.2001 +test filename-17.2 {windows specific glob with executable} {winOnly} {
1.2002 + makeDirectory execglob
1.2003 + makeFile contents execglob/abc.exe
1.2004 + makeFile contents execglob/abc.notexecutable
1.2005 + set res [glob -nocomplain -dir [temporaryDirectory]/execglob \
1.2006 + -tails -types x *]
1.2007 + removeFile execglob/abc.exe
1.2008 + removeFile execglob/abc.notexecutable
1.2009 + removeDirectory execglob
1.2010 + set res
1.2011 +} {abc.exe}
1.2012 +
1.2013 +test fileName-18.1 {windows - split ADS name correctly} {winOnly} {
1.2014 + # bug 1194458
1.2015 + set x [file split c:/c:d]
1.2016 + set y [eval [linsert $x 0 file join]]
1.2017 + list $x $y
1.2018 +} {{c:/ ./c:d} c:/c:d}
1.2019 +
1.2020 +# cleanup
1.2021 +catch {file delete -force C:/globTest}
1.2022 +cd [temporaryDirectory]
1.2023 +file delete -force globTest
1.2024 +cd $oldpwd
1.2025 +set env(HOME) $oldhome
1.2026 +if {[tcltest::testConstraint testsetplatform]} {
1.2027 + testsetplatform $platform
1.2028 + catch {unset platform}
1.2029 +}
1.2030 +catch {unset oldhome temp result globPreResult}
1.2031 +::tcltest::cleanupTests
1.2032 +return