summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-20 23:17:11 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-03-20 23:17:11 (GMT)
commitf5c47e4402864aa6d6f5f120c231c39423dcc360 (patch)
treeefdee848211287b5ec7004f2463e8ed85536acce /tests
parent4ea926a40b6c03000b32b4765503b75a3909dbc0 (diff)
downloadtcl-f5c47e4402864aa6d6f5f120c231c39423dcc360.zip
tcl-f5c47e4402864aa6d6f5f120c231c39423dcc360.tar.gz
tcl-f5c47e4402864aa6d6f5f120c231c39423dcc360.tar.bz2
Proposed fix for [1bedc53c8c]: synchronous [read] with -strictencoding does not produce an error on invalid input
Diffstat (limited to 'tests')
-rw-r--r--tests/io.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index cf90936..9246bd8 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -9171,6 +9171,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+]