From 0f674c548252976d41f9ac1c0cf4668cb8eaaabe Mon Sep 17 00:00:00 2001 From: oehhar Date: Sun, 11 Sep 2022 08:39:20 +0000 Subject: Tests io-75.x tolerant encoding: correct indention and comments --- tests/io.test | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/io.test b/tests/io.test index 764e9f0..e338749 100644 --- a/tests/io.test +++ b/tests/io.test @@ -8814,58 +8814,58 @@ 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 75.1 to 75.3 are in preparation for TCL 9.0, where -# those should result in an error result +# The following tests 75.1 to 75.3 exercice strict or tolerant channel +# encoding. +# TCL 8.6 only offers tolerant channel encoding, what is tested here. test io-75.1 {multibyte encoding error read results in raw bytes} -setup { - set fn [makeFile {} io-75.1] + set fn [makeFile {} io-75.1] set f [open $fn w+] fconfigure $f -encoding binary - # In UTF-8, a byte 0xCx starts a multibyte sequence and must be followed - # by a byte > 0x7F. This is violated to get an invalid sequence. - puts -nonewline $f "A\xC0\x40" - flush $f - seek $f 0 - fconfigure $f -encoding utf-8 -buffering none + # In UTF-8, a byte 0xCx starts a multibyte sequence and must be followed + # by a byte > 0x7F. This is violated to get an invalid sequence. + puts -nonewline $f "A\xC0\x40" + flush $f + seek $f 0 + fconfigure $f -encoding utf-8 -buffering none } -body { - read $f + read $f } -cleanup { - close $f - removeFile io-75.1 + 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 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 + puts -nonewline $f "A\u2022" + flush $f + seek $f 0 + read $f } -cleanup { - close $f - removeFile io-75.2 + close $f + removeFile io-75.2 } -returnCodes ok -result "A?" # Incomplete sequence test. # This error may IMHO only be detected with the close. # But the read already returns the incomplete sequence. test io-75.3 {incomplete multibyte encoding read is ignored} -setup { - set fn [makeFile {} io-75.3] + set fn [makeFile {} io-75.3] set f [open $fn w+] fconfigure $f -encoding binary - puts -nonewline $f "A\xC0" - flush $f - seek $f 0 - fconfigure $f -encoding utf-8 -buffering none + puts -nonewline $f "A\xC0" + flush $f + seek $f 0 + fconfigure $f -encoding utf-8 -buffering none } -body { - set d [read $f] - close $f - set d + set d [read $f] + close $f + set d } -cleanup { - removeFile io-75.3 + removeFile io-75.3 } -returnCodes ok -result "A\xC0" # ### ### ### ######### ######### ######### -- cgit v0.12