summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-21 16:54:19 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-21 16:54:19 (GMT)
commit4f5ae9bf24ee4d8e6a6ef358b0e0b8de76968a2e (patch)
treeb4ec1d31b847455213aa61ffff3bb6f1ac274769 /tests
parentafdd59e3580b6a38098fa8faac3db12052f232d8 (diff)
parent9152d5eec0903e1bb99607fa9a87e2453a25e13d (diff)
downloadtcl-4f5ae9bf24ee4d8e6a6ef358b0e0b8de76968a2e.zip
tcl-4f5ae9bf24ee4d8e6a6ef358b0e0b8de76968a2e.tar.gz
tcl-4f5ae9bf24ee4d8e6a6ef358b0e0b8de76968a2e.tar.bz2
Merge 8.7
Diffstat (limited to 'tests')
-rw-r--r--tests/io.test26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/io.test b/tests/io.test
index 034316e..b5cc082 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -9173,10 +9173,10 @@ test io-75.3 {incomplete multibyte encoding read is ignored (-profile tcl8)} -se
fconfigure $f -encoding utf-8 -buffering none -profile tcl8
} -body {
set d [read $f]
- close $f
binary scan $d H* hd
set hd
} -cleanup {
+ close $f
removeFile io-75.3
} -result 41c0
@@ -9211,10 +9211,10 @@ test io-75.5 {invalid utf-8 encoding read is ignored (-profile tcl8)} -setup {
fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile tcl8
} -body {
set d [read $f]
- close $f
binary scan $d H* hd
set hd
} -cleanup {
+ close $f
removeFile io-75.5
} -result 4181
@@ -9234,6 +9234,22 @@ test io-75.6 {invalid utf-8 encoding gets is not ignored (-profile strict)} -set
removeFile io-75.6
} -match glob -returnCodes 1 -result {error reading "*": illegal byte sequence}
+test io-75.7 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup {
+ set fn [makeFile {} io-75.7]
+ set f [open $fn w+]
+ fconfigure $f -encoding binary
+ # \x81 is invalid in utf-8
+ puts -nonewline $f A\x81
+ flush $f
+ seek $f 0
+ fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile strict
+} -body {
+ read $f
+} -cleanup {
+ close $f
+ removeFile io-75.7
+} -match glob -returnCodes 1 -result {error reading "*": illegal byte sequence}
+
test io-75.8 {invalid utf-8 encoding eof handling (-profile strict)} -setup {
set fn [makeFile {} io-75.8]
set f [open $fn w+]
@@ -9281,10 +9297,10 @@ test io-75.10 {incomplete multibyte encoding read is ignored} -setup {
fconfigure $f -encoding utf-8 -buffering none
} -body {
set d [read $f]
- close $f
binary scan $d H* hd
set hd
} -cleanup {
+ close $f
removeFile io-75.10
} -result 41c0
# The current result returns the orphan byte as byte.
@@ -9301,7 +9317,7 @@ test io-75.11 {shiftjis encoding error read results in raw bytes} -setup {
puts -nonewline $f A\x81\xFFA
flush $f
seek $f 0
- fconfigure $f -encoding shiftjis -buffering none -eofchar "" -translation lf -profile strict
+ fconfigure $f -encoding shiftjis -blocking 0 -eofchar "" -translation lf -profile strict
} -body {
set d [read $f]
binary scan $d H* hd
@@ -9336,7 +9352,7 @@ test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -se
puts -nonewline $f "A\x81"
flush $f
seek $f 0
- fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile strict
+ fconfigure $f -encoding utf-8 -blocking 0 -eofchar "" -translation lf -profile strict
} -body {
set d [read $f]
binary scan $d H* hd