summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-21 08:45:56 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-21 08:45:56 (GMT)
commitafdd59e3580b6a38098fa8faac3db12052f232d8 (patch)
tree9d8e420444410dc60e1765586e7a7c13634f7507 /tests/io.test
parent6ff9d841db20402b12687f25521cedbed683deca (diff)
parent8f3fb2f85e9212f570254b21558c21ffcde26b08 (diff)
downloadtcl-afdd59e3580b6a38098fa8faac3db12052f232d8.zip
tcl-afdd59e3580b6a38098fa8faac3db12052f232d8.tar.gz
tcl-afdd59e3580b6a38098fa8faac3db12052f232d8.tar.bz2
Merge 8.7
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/io.test b/tests/io.test
index 538f554..034316e 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -9218,6 +9218,22 @@ test io-75.5 {invalid utf-8 encoding read is ignored (-profile tcl8)} -setup {
removeFile io-75.5
} -result 4181
+test io-75.6 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup {
+ set fn [makeFile {} io-75.6]
+ 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 {
+ gets $f
+} -cleanup {
+ close $f
+ removeFile io-75.6
+} -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+]
@@ -9306,10 +9322,10 @@ test io-75.12 {invalid utf-8 encoding read is ignored} -setup {
fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf
} -body {
set d [read $f]
- close $f
binary scan $d H* hd
set hd
} -cleanup {
+ close $f
removeFile io-75.12
} -result 4181
test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -setup {
@@ -9325,9 +9341,9 @@ test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -se
set d [read $f]
binary scan $d H* hd
lappend hd [catch {read $f} msg]
- close $f
lappend hd $msg
} -cleanup {
+ close $f
removeFile io-75.13
} -match glob -result {41 1 {error reading "*": illegal byte sequence}}