summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2022-09-09 13:34:30 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2022-09-09 13:34:30 (GMT)
commitb83ee238f996e0d84b24b61566fedf5fb91919d9 (patch)
tree641cd11257d1067fe2dd2483a8a85df8c2d4bb16 /tests
parent41e8f7c84390f1ed0ef602aba40544b6b2f383da (diff)
downloadtcl-b83ee238f996e0d84b24b61566fedf5fb91919d9.zip
tcl-b83ee238f996e0d84b24b61566fedf5fb91919d9.tar.gz
tcl-b83ee238f996e0d84b24b61566fedf5fb91919d9.tar.bz2
Ticket [6978c01b65]: add file encoding tests, which should fail in 9.0, but are ok in 8.6 and 8.7: write unrepresentable character and read invalid multi-byte character
Diffstat (limited to 'tests')
-rw-r--r--tests/io.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index 3b374c1..7c12b7b 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -8805,6 +8805,39 @@ test io-74.1 {[104f2885bb] improper cache validity check} -setup {
removeFile io-74.1
} -returnCodes error -match glob -result {can not find channel named "*"}
+# Note: the following tests are in preparation for TCL 9.0, where those should
+# result in an error result
+test io-75.1 {multibyte encoding error read results in raw bytes} -setup {
+ set fn [makeFile {} io-75.1]
+ set f [open $fn w+]
+ fconfigure $f -encoding binary
+ puts -nonewline $f "A\xC0\x40"
+ flush $f
+ seek $f 0
+ fconfigure $f -encoding utf-8 -buffering none
+} -body {
+ read $f
+} -cleanup {
+ close $f
+ removeFile io-75.1
+} -returnCodes ok -result "A\xC0\x40"
+# for TCL 9.0, the result is error
+
+test io-75.2 {unrepresentable character write passes and is replaced by ?} -setup {
+ set fn [makeFile {} io-75.2]
+ set f [open $fn w+]
+ fconfigure $f -encoding iso8859-1
+} -body {
+ # the following command gets in result error in TCL 9.0
+ puts -nonewline $f "A\u2022"
+ flush $f
+ seek $f 0
+ read $f
+} -cleanup {
+ close $f
+ removeFile io-75.2
+} -returnCodes ok -result "A?"
+
# ### ### ### ######### ######### #########
# cleanup