summaryrefslogtreecommitdiffstats
path: root/tests/cmdAH.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cmdAH.test')
-rw-r--r--tests/cmdAH.test78
1 files changed, 33 insertions, 45 deletions
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index eb2298e..2b70484 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -83,8 +83,6 @@ test cmdAH-0.2 {Tcl_BreakObjCmd, success} {
list [catch {break} msg] $msg
} {3 {}}
-# Tcl_CaseObjCmd is tested in case.test
-
test cmdAH-1.1 {Tcl_CatchObjCmd, errors} -returnCodes error -body {
catch
} -result {wrong # args: should be "catch script ?resultVarName? ?optionVarName?"}
@@ -125,7 +123,7 @@ test cmdAH-2.3 {Tcl_CdObjCmd} -setup {
set env(HOME) $oldpwd
file mkdir $foodir
cd $foodir
- cd ~
+ cd [file home]
string equal [pwd] $oldpwd
} -cleanup {
cd $oldpwd
@@ -149,8 +147,21 @@ test cmdAH-2.4 {Tcl_CdObjCmd} -setup {
set env(HOME) $temp
} -result 1
test cmdAH-2.5 {Tcl_CdObjCmd} -returnCodes error -body {
- cd ~~
-} -result {user "~" doesn't exist}
+ cd ~
+} -result {couldn't change working directory to "~": no such file or directory}
+test cmdAH-2.5.1 {Tcl_CdObjCmd} -setup {
+ set oldpwd [pwd]
+ cd [temporaryDirectory]
+ file delete ./~
+ file mkdir ~
+} -body {
+ cd ~
+ pwd
+} -cleanup {
+ cd [temporaryDirectory]
+ file delete ./~
+ cd $oldpwd
+} -result [file join [temporaryDirectory] ~]
test cmdAH-2.6 {Tcl_CdObjCmd} -returnCodes error -body {
cd _foobar
} -result {couldn't change working directory to "_foobar": no such file or directory}
@@ -831,7 +842,7 @@ test cmdAH-8.43 {Tcl_FileObjCmd: dirname} -setup {
} -constraints testsetplatform -body {
set env(HOME) "/homewontexist/test"
testsetplatform unix
- file dirname ~
+ file dirname [file home]
} -cleanup {
set env(HOME) $temp
} -result /homewontexist
@@ -841,19 +852,13 @@ test cmdAH-8.44 {Tcl_FileObjCmd: dirname} -setup {
} -constraints testsetplatform -body {
set env(HOME) "~"
testsetplatform unix
- file dirname ~
+ file dirname [file home]
} -cleanup {
set env(HOME) $temp
-} -result ~
-test cmdAH-8.45 {Tcl_FileObjCmd: dirname} -setup {
- set temp $::env(HOME)
-} -constraints {win testsetplatform} -match regexp -body {
- set ::env(HOME) "/homewontexist/test"
- testsetplatform windows
+} -result .
+test cmdAH-8.45 {Tcl_FileObjCmd: dirname ~} -body {
file dirname ~
-} -cleanup {
- set ::env(HOME) $temp
-} -result {([a-zA-Z]:?)/homewontexist}
+} -result .
test cmdAH-8.46 {Tcl_FileObjCmd: dirname} {
set f [file normalize [info nameof]]
file exists $f
@@ -961,36 +966,19 @@ test cmdAH-9.26 {Tcl_FileObjCmd: tail} testsetplatform {
testsetplatform windows
file tail {//foo/bar}
} {}
-test cmdAH-9.42 {Tcl_FileObjCmd: tail} -constraints testsetplatform -setup {
- global env
- set temp $env(HOME)
-} -body {
- set env(HOME) "/home/test"
- testsetplatform unix
+test cmdAH-9.42 {Tcl_FileObjCmd: tail ~} -body {
file tail ~
-} -cleanup {
- set env(HOME) $temp
-} -result test
+} -result ~
test cmdAH-9.43 {Tcl_FileObjCmd: tail} -constraints testsetplatform -setup {
global env
set temp $env(HOME)
} -body {
set env(HOME) "~"
testsetplatform unix
- file tail ~
+ file tail [file home]
} -cleanup {
set env(HOME) $temp
-} -result {}
-test cmdAH-9.44 {Tcl_FileObjCmd: tail} -constraints testsetplatform -setup {
- global env
- set temp $env(HOME)
-} -body {
- set env(HOME) "/home/test"
- testsetplatform windows
- file tail ~
-} -cleanup {
- set env(HOME) $temp
-} -result test
+} -result ~
test cmdAH-9.46 {Tcl_FileObjCmd: tail} testsetplatform {
testsetplatform unix
file tail {f.oo\bar/baz.bat}
@@ -1021,7 +1009,7 @@ test cmdAH-9.52 {Tcl_FileObjCmd: tail / normalize, bug 7a9dc52b29} {
[file tail {~/test/~foo}] \
[file tail [file normalize {~/~foo}]] \
[file tail [file normalize {~/test/~foo}]]
-} [lrepeat 4 ./~foo]
+} [lrepeat 4 ~foo]
# rootname
test cmdAH-10.1 {Tcl_FileObjCmd: rootname} -returnCodes error -body {
@@ -1275,7 +1263,7 @@ test cmdAH-14.3 {Tcl_FileObjCmd: join} testsetplatform {
test cmdAH-15.1 {Tcl_FileObjCmd} -constraints testsetplatform -body {
testsetplatform unix
file atime ~_bad_user
-} -returnCodes error -result {user "_bad_user" doesn't exist}
+} -returnCodes error -result {could not read "~_bad_user": no such file or directory}
catch {testsetplatform $platform}
@@ -1398,9 +1386,8 @@ test cmdAH-19.9 {Tcl_FileObjCmd: ~ : exists} {
file exists ~nOsUcHuSeR
} 0
test cmdAH-19.10 {Tcl_FileObjCmd: ~ : nativename} -body {
- # should probably be a non-error in fact...
file nativename ~nOsUcHuSeR
-} -returnCodes error -match glob -result *
+} -result ~nOsUcHuSeR
# The test below has to be done in /tmp rather than the current directory in
# order to guarantee (?) a local file system: some NFS file systems won't do
# the stuff below correctly.
@@ -1743,6 +1730,8 @@ test cmdAH-24.14.1 {
test cmdAH-24.20.1 {Tcl_FileObjCmd: atime 64-bit time_t, bug [4718b41c56]} -constraints {time64bit filetime64bit} -setup {
set filename [makeFile "" foo.text]
} -body {
+ # This test may fail if your system does not have a 64-bit time_t.
+ # That is to be expected and is not a problem with Tcl.
list [file atime $filename 3155760000] [file atime $filename]
} -cleanup {
removeFile $filename
@@ -1750,6 +1739,8 @@ test cmdAH-24.20.1 {Tcl_FileObjCmd: atime 64-bit time_t, bug [4718b41c56]} -cons
test cmdAH-24.20.2 {Tcl_FileObjCmd: mtime 64-bit time_t, bug [4718b41c56]} -constraints {time64bit filetime64bit} -setup {
set filename [makeFile "" foo.text]
} -body {
+ # This test may fail if your system does not have a 64-bit time_t.
+ # That is to be expected and is not a problem with Tcl.
list [file mtime $filename 3155760000] [file mtime $filename]
} -cleanup {
file delete -force $filename
@@ -1825,7 +1816,7 @@ test cmdAH-27.1 {Tcl_FileObjCmd: size} -returnCodes error -body {
test cmdAH-27.2 {Tcl_FileObjCmd: size} {
set oldsize [file size $gorpfile]
set f [open $gorpfile a]
- fconfigure $f -translation lf -eofchar {}
+ fconfigure $f -translation lf
puts $f "More text"
close $f
expr {[file size $gorpfile] - $oldsize}
@@ -2044,9 +2035,6 @@ test cmdAH-30.6 {Tcl_FileObjCmd: error conditions} -returnCodes error -body {
test cmdAH-30.7 {Tcl_FileObjCmd: error conditions} -returnCodes error -body {
file t x
} -match glob -result {unknown or ambiguous subcommand "t": must be *}
-test cmdAH-30.8 {Tcl_FileObjCmd: error conditions} -returnCodes error -body {
- file dirname ~woohgy
-} -result {user "woohgy" doesn't exist}
# channels
# In testing 'file channels', we need to make sure that a channel created in