summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-26 17:25:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-26 17:25:22 (GMT)
commit0b7d58de0e0ccef5c0d5194721d9b59db50fce1d (patch)
tree9bac945cbed369b0ed12b000b7792d9d320be258 /tests
parentb246adbfbd4b44ebda9dc4d51430f00bdd677814 (diff)
parent3636d805fcf6da495f444297a7159347ff1ed3a0 (diff)
downloadtcl-0b7d58de0e0ccef5c0d5194721d9b59db50fce1d.zip
tcl-0b7d58de0e0ccef5c0d5194721d9b59db50fce1d.tar.gz
tcl-0b7d58de0e0ccef5c0d5194721d9b59db50fce1d.tar.bz2
Merge 8.7
Diffstat (limited to 'tests')
-rw-r--r--tests/cmdAH.test22
-rw-r--r--tests/io.test118
-rw-r--r--tests/stringObj.test2
3 files changed, 135 insertions, 7 deletions
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index a734541..a9e199e 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -1194,10 +1194,10 @@ test cmdAH-22.3 {Tcl_FileObjCmd: isfile} {file isfile $dirfile} 0
catch {file link -symbolic $linkfile $gorpfile}
test cmdAH-23.1 {Tcl_FileObjCmd: lstat} -returnCodes error -body {
file lstat a
-} -result {wrong # args: should be "file lstat name varName"}
+} -result {could not read "a": no such file or directory}
test cmdAH-23.2 {Tcl_FileObjCmd: lstat} -returnCodes error -body {
file lstat a b c
-} -result {wrong # args: should be "file lstat name varName"}
+} -result {wrong # args: should be "file lstat name ?varName?"}
test cmdAH-23.3 {Tcl_FileObjCmd: lstat} -setup {
unset -nocomplain stat
} -constraints {unix nonPortable} -body {
@@ -1527,14 +1527,14 @@ catch {file attributes $gorpfile -permissions 0o765}
# stat
test cmdAH-28.1 {Tcl_FileObjCmd: stat} -returnCodes error -body {
- file stat _bogus_
-} -result {wrong # args: should be "file stat name varName"}
+ file stat
+} -result {wrong # args: should be "file stat name ?varName?"}
test cmdAH-28.2 {Tcl_FileObjCmd: stat} -returnCodes error -body {
file stat _bogus_ a b
-} -result {wrong # args: should be "file stat name varName"}
+} -result {wrong # args: should be "file stat name ?varName?"}
test cmdAH-28.3 {Tcl_FileObjCmd: stat} -setup {
unset -nocomplain stat
- set stat(blocks) [set stat(blksize) {}]
+ array set stat {blocks {} blksize {}}
} -body {
file stat $gorpfile stat
unset stat(blocks) stat(blksize); # Ignore these fields; not always set
@@ -1627,6 +1627,16 @@ test cmdAH-28.13.1 {Tcl_FileObjCmd: stat (built-in Windows names)} -constraints
}
set res
} -result {0 0 -1 0 0 8630 0 0 0 characterSpecial 0}
+test cmdAH-28.14 {Tcl_FileObjCmd: stat} -setup {
+ unset -nocomplain stat
+} -body {
+ file stat $gorpfile stat
+ expr {
+ [lsort -stride 2 [array get stat]]
+ eq
+ [lsort -stride 2 [file stat $gorpfile]]
+ }
+} -result {1}
unset -nocomplain stat
# type
diff --git a/tests/io.test b/tests/io.test
index 32c4b99..96abadd 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -9050,6 +9050,124 @@ test io-75.5 {incomplete shiftjis encoding read is ignored} -setup {
# ### ### ### ######### ######### #########
+
+
+test io-75.0 {channel modes} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r]
+} -constraints testchannel -body {
+ testchannel mode $f
+} -cleanup {
+ close $f
+ removeFile dummy
+} -result {read {}}
+
+test io-75.1 {channel modes} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile w]
+} -constraints testchannel -body {
+ testchannel mode $f
+} -cleanup {
+ close $f
+ removeFile dummy
+} -result {{} write}
+
+test io-75.2 {channel modes} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r+]
+} -constraints testchannel -body {
+ testchannel mode $f
+} -cleanup {
+ close $f
+ removeFile dummy
+} -result {read write}
+
+test io-75.3 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r]
+} -constraints testchannel -body {
+ testchannel mremove-wr $f
+ list [testchannel mode $f] [testchannel maxmode $f]
+} -cleanup {
+ close $f
+ removeFile dummy
+} -result {{read {}} {read {}}}
+
+test io-75.4 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r]
+} -constraints testchannel -body {
+ testchannel mremove-rd $f
+} -returnCodes error -cleanup {
+ close $f
+ removeFile dummy
+} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+
+test io-75.5 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile w]
+} -constraints testchannel -body {
+ testchannel mremove-rd $f
+ list [testchannel mode $f] [testchannel maxmode $f]
+} -cleanup {
+ close $f
+ removeFile dummy
+} -result {{{} write} {{} write}}
+
+test io-75.6 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile w]
+} -constraints testchannel -body {
+ testchannel mremove-wr $f
+} -returnCodes error -cleanup {
+ close $f
+ removeFile dummy
+} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+
+test io-75.7 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r+]
+} -constraints testchannel -body {
+ testchannel mremove-rd $f
+ list [testchannel mode $f] [testchannel maxmode $f]
+} -cleanup {
+ close $f
+ removeFile dummy
+} -result {{{} write} {read write}}
+
+test io-75.8 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r+]
+} -constraints testchannel -body {
+ testchannel mremove-wr $f
+ list [testchannel mode $f] [testchannel maxmode $f]
+} -cleanup {
+ close $f
+ removeFile dummy
+} -result {{read {}} {read write}}
+
+test io-75.9 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r+]
+} -constraints testchannel -body {
+ testchannel mremove-wr $f
+ testchannel mremove-rd $f
+} -returnCodes error -cleanup {
+ close $f
+ removeFile dummy
+} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+
+test io-75.10 {channel mode dropping} -setup {
+ set datafile [makeFile {some characters} dummy]
+ set f [open $datafile r+]
+} -constraints testchannel -body {
+ testchannel mremove-rd $f
+ testchannel mremove-wr $f
+} -returnCodes error -cleanup {
+ close $f
+ removeFile dummy
+} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+
# cleanup
foreach file [list fooBar longfile script script2 output test1 pipe my_script \
test2 test3 cat stdout kyrillic.txt utf8-fcopy.txt utf8-rp.txt] {
diff --git a/tests/stringObj.test b/tests/stringObj.test
index 14ba79d..0c65cdc 100644
--- a/tests/stringObj.test
+++ b/tests/stringObj.test
@@ -497,7 +497,7 @@ test stringObj-16.5 {Tcl_GetRange: fist = last = -1} {testobj deprecated} {
teststringobj set 1 abcde
teststringobj range 1 -1 -1
} abcde
-test stringObj-16.6 {Tcl_GetRange: old anomaly} testobj {
+test stringObj-16.6 {Tcl_GetRange: old anomaly} {testobj deprecated} {
# Older implementations could return "cde"
teststringobj set 1 abcde
teststringobj range 1 2 0