diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-21 08:45:56 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-21 08:45:56 (GMT) |
commit | afdd59e3580b6a38098fa8faac3db12052f232d8 (patch) | |
tree | 9d8e420444410dc60e1765586e7a7c13634f7507 /tests/io.test | |
parent | 6ff9d841db20402b12687f25521cedbed683deca (diff) | |
parent | 8f3fb2f85e9212f570254b21558c21ffcde26b08 (diff) | |
download | tcl-afdd59e3580b6a38098fa8faac3db12052f232d8.zip tcl-afdd59e3580b6a38098fa8faac3db12052f232d8.tar.gz tcl-afdd59e3580b6a38098fa8faac3db12052f232d8.tar.bz2 |
Merge 8.7
Diffstat (limited to 'tests/io.test')
-rw-r--r-- | tests/io.test | 20 |
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}} |