diff options
| -rwxr-xr-x | generic/tclArithSeries.c | 2 | ||||
| -rw-r--r-- | tests/chanio.test | 47 | ||||
| -rw-r--r-- | tests/encoding.test | 2 | ||||
| -rw-r--r-- | tests/io.test | 93 |
4 files changed, 69 insertions, 75 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c index cd3b54f..129f28d 100755 --- a/generic/tclArithSeries.c +++ b/generic/tclArithSeries.c @@ -432,7 +432,7 @@ assignNumber( void *clientData; int tcl_number_type; - if (Tcl_GetNumberFromObj(interp, numberObj, &clientData, + if (Tcl_GetNumberFromObj(interp, numberObj, &clientData, &tcl_number_type) != TCL_OK) { return TCL_ERROR; } diff --git a/tests/chanio.test b/tests/chanio.test index 1367730..bfbd031 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -82,8 +82,8 @@ namespace eval ::tcl::test::io { if {$argv != ""} { set f [open [lindex $argv 0]] } - chan configure $f -encoding binary -translation lf -blocking 0 -eofchar "\x1A \x1A" - chan configure stdout -encoding binary -translation lf -buffering none + chan configure $f -translation binary -blocking 0 -eofchar "\x1A \x1A" + chan configure stdout -translation binary -buffering none chan event $f readable "foo $f" proc foo {f} { set x [chan read $f] @@ -117,7 +117,7 @@ test chan-io-1.5 {Tcl_WriteChars: CheckChannelErrors} {emptyTest} { set path(test1) [makeFile {} test1] test chan-io-1.6 {Tcl_WriteChars: WriteBytes} { set f [open $path(test1) w] - chan configure $f -encoding binary + chan configure $f -translation binary chan puts -nonewline $f "a\x4D\x00" chan close $f contents $path(test1) @@ -186,7 +186,7 @@ test chan-io-1.9 {Tcl_WriteChars: WriteChars} { test chan-io-2.1 {WriteBytes} { # loop until all bytes are written set f [open $path(test1) w] - chan configure $f -encoding binary -buffersize 16 -translation crlf + chan configure $f -translation binary -buffersize 16 -translation crlf chan puts $f "abcdefghijklmnopqrstuvwxyz" chan close $f contents $path(test1) @@ -195,7 +195,7 @@ test chan-io-2.2 {WriteBytes: savedLF > 0} { # After flushing buffer, there was a \n left over from the last # \n -> \r\n expansion. It gets stuck at beginning of this buffer. set f [open $path(test1) w] - chan configure $f -encoding binary -buffersize 16 -translation crlf + chan configure $f -translation binary -buffersize 16 -translation crlf chan puts -nonewline $f "123456789012345\n12" set x [list [contents $path(test1)]] chan close $f @@ -206,7 +206,7 @@ test chan-io-2.3 {WriteBytes: flush on line} -body { # \n, entire buffer gets flushed. Logical behavior would be to flush only # up to the \n. set f [open $path(test1) w] - chan configure $f -encoding binary -buffering line -translation crlf + chan configure $f -translation binary -buffering line -translation crlf chan puts -nonewline $f "\n12" contents $path(test1) } -cleanup { @@ -214,8 +214,7 @@ test chan-io-2.3 {WriteBytes: flush on line} -body { } -result "\r\n12" test chan-io-2.4 {WriteBytes: reset sawLF after each buffer} { set f [open $path(test1) w] - chan configure $f -encoding binary -buffering line -translation lf \ - -buffersize 16 + chan configure $f -translation binary -buffering line -buffersize 16 chan puts -nonewline $f "abcdefg\nhijklmnopqrstuvwxyz" set x [list [contents $path(test1)]] chan close $f @@ -1081,7 +1080,7 @@ test chan-io-7.1 {FilterInputBytes: split up character at end of buffer} -body { test chan-io-7.2 {FilterInputBytes: split up character in middle of buffer} -body { # (bufPtr->nextAdded < bufPtr->bufLength) set f [open $path(test1) w] - chan configure $f -encoding binary + chan configure $f -translation binary chan puts -nonewline $f "1234567890\n123\x82\x4F\x82\x50\x82" chan close $f set f [open $path(test1)] @@ -1094,7 +1093,7 @@ test chan-io-7.3 {FilterInputBytes: split up character at EOF} -setup { set x "" } -constraints {testchannel} -body { set f [open $path(test1) w] - chan configure $f -encoding binary + chan configure $f -translation binary chan puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82" chan close $f set f [open $path(test1)] @@ -1109,14 +1108,14 @@ test chan-io-7.4 {FilterInputBytes: recover from split up character} -setup { variable x "" } -constraints {stdio fileevent} -body { set f [openpipe w+ $path(cat)] - chan configure $f -encoding binary -buffering none + chan configure $f -translation binary -buffering none chan puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82" chan configure $f -encoding shiftjis -blocking 0 chan event $f read [namespace code { lappend x [chan gets $f line] $line [chan blocked $f] }] vwait [namespace which -variable x] - chan configure $f -encoding binary -blocking 1 + chan configure $f -translation binary -blocking 1 chan puts $f "\x51\x82\x52" chan configure $f -encoding shiftjis vwait [namespace which -variable x] @@ -1178,7 +1177,7 @@ test chan-io-8.4 {PeekAhead: cached data available in this buffer} -body { chan puts $f "${a}\r\nabcdef" chan close $f set f [open $path(test1)] - chan configure $f -encoding binary -translation auto + chan configure $f -translation binary -translation auto # "${a}\r" was converted in one operation (because ENCODING_LINESIZE is # 30). To check if "\n" follows, calls PeekAhead and determines that # cached data is available in buffer w/o having to call driver. @@ -1283,7 +1282,7 @@ test chan-io-11.1 {ReadBytes: want to read a lot} -body { chan puts -nonewline $f abcdefghijkl chan close $f set f [open $path(test1)] - chan configure $f -encoding binary + chan configure $f -translation binary # here chan read $f 1000 } -cleanup { @@ -1295,7 +1294,7 @@ test chan-io-11.2 {ReadBytes: want to read all} -body { chan puts -nonewline $f abcdefghijkl chan close $f set f [open $path(test1)] - chan configure $f -encoding binary + chan configure $f -translation binary # here chan read $f } -cleanup { @@ -1307,7 +1306,7 @@ test chan-io-11.3 {ReadBytes: allocate more space} -body { chan puts -nonewline $f abcdefghijklmnopqrstuvwxyz chan close $f set f [open $path(test1)] - chan configure $f -buffersize 16 -encoding binary + chan configure $f -buffersize 16 -translation binary # here chan read $f } -cleanup { @@ -1319,7 +1318,7 @@ test chan-io-11.4 {ReadBytes: EOF char found} -body { chan puts $f abcdefghijklmnopqrstuvwxyz chan close $f set f [open $path(test1)] - chan configure $f -eofchar m -encoding binary + chan configure $f -translation binary -eofchar m # here list [chan read $f] [chan eof $f] [chan read $f] [chan eof $f] } -cleanup { @@ -1365,7 +1364,7 @@ test chan-io-12.4 {ReadChars: split-up char} -setup { } -constraints {stdio testchannel fileevent} -body { # (srcRead == 0) set f [openpipe w+ $path(cat)] - chan configure $f -encoding binary -buffering none -buffersize 16 + chan configure $f -translation binary -buffering none -buffersize 16 chan puts -nonewline $f "123456789012345\x96" chan configure $f -encoding shiftjis -blocking 0 chan event $f read [namespace code { @@ -1373,7 +1372,7 @@ test chan-io-12.4 {ReadChars: split-up char} -setup { }] chan configure $f -encoding shiftjis vwait [namespace which -variable x] - chan configure $f -encoding binary -blocking 1 + chan configure $f -translation binary -blocking 1 chan puts -nonewline $f \x7B after 500 ;# Give the cat process time to catch up chan configure $f -encoding shiftjis -blocking 0 @@ -1386,7 +1385,7 @@ test chan-io-12.5 {ReadChars: chan events on partial characters} -setup { variable x {} } -constraints {stdio fileevent} -body { set path(test1) [makeFile { - chan configure stdout -encoding binary -buffering none + chan configure stdout -translation binary -buffering none chan gets stdin; chan puts -nonewline \xE7 chan gets stdin; chan puts -nonewline \x89 chan gets stdin; chan puts -nonewline \xA6 @@ -4537,7 +4536,7 @@ test chan-io-34.21 {Tcl_Seek and Tcl_Tell on large files} -setup { set l "" } -constraints {largefileSupport extensive} -body { set f [open $path(test3) w] - chan configure $f -encoding binary + chan configure $f -translation binary lappend l [chan tell $f] chan puts -nonewline $f abcdef lappend l [chan tell $f] @@ -5178,7 +5177,7 @@ test chan-io-39.14 {Tcl_SetChannelOption: -encoding, binary & utf-8} -setup { file delete $path(test1) } -body { set f [open $path(test1) w] - chan configure $f -encoding {} + chan configure $f -translation binary chan puts -nonewline $f \xE7\x89\xA6 chan close $f set f [open $path(test1) r] @@ -5191,7 +5190,7 @@ test chan-io-39.15 {Tcl_SetChannelOption: -encoding, binary & utf-8} -setup { file delete $path(test1) } -body { set f [open $path(test1) w] - chan configure $f -encoding binary + chan configure $f -translation binary chan puts -nonewline $f \xE7\x89\xA6 chan close $f set f [open $path(test1) r] @@ -6880,7 +6879,6 @@ test chan-io-52.10 {TclCopyChannel & encodings} -constraints {fcopy notWinCI} -b set in [open $path(kyrillic.txt) r] set out [open $path(utf8-fcopy.txt) w] chan configure $in -encoding koi8-r -translation lf - # -translation binary is also -encoding binary chan configure $out -translation binary chan copy $in $out file size $path(utf8-fcopy.txt) @@ -6899,7 +6897,6 @@ test chan-io-52.11 {TclCopyChannel & encodings} -setup { # encoder set in [open $path(utf8-fcopy.txt) r] set out [open $path(kyrillic.txt) w] - # -translation binary is also -encoding binary chan configure $in -translation binary chan configure $out -encoding koi8-r -translation lf chan copy $in $out diff --git a/tests/encoding.test b/tests/encoding.test index 1b75e51..5530178 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -681,7 +681,7 @@ casino_japanese@___.com )までご住所変更済の連絡をいただけな cd [temporaryDirectory] set fid [open iso2022.txt w] -fconfigure $fid -encoding binary +fconfigure $fid -translation binary puts -nonewline $fid $iso2022encData close $fid diff --git a/tests/io.test b/tests/io.test index be9cfb7..a95a154 100644 --- a/tests/io.test +++ b/tests/io.test @@ -79,8 +79,8 @@ set path(cat) [makeFile { if {$argv != ""} { set f [open [lindex $argv 0]] } - fconfigure $f -encoding binary -translation lf -blocking 0 -eofchar "\x1A \x1A" - fconfigure stdout -encoding binary -translation lf -buffering none + fconfigure $f -translation binary -blocking 0 -eofchar "\x1A \x1A" + fconfigure stdout -translation binary -buffering none fileevent $f readable "foo $f" proc foo {f} { set x [read $f] @@ -109,7 +109,7 @@ test io-1.5 {Tcl_WriteChars: CheckChannelErrors} {emptyTest} { set path(test1) [makeFile {} test1] test io-1.6 {Tcl_WriteChars: WriteBytes} { set f [open $path(test1) w] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f "a\x4D\x00" close $f contents $path(test1) @@ -200,7 +200,7 @@ test io-2.1 {WriteBytes} { # loop until all bytes are written set f [open $path(test1) w] - fconfigure $f -encoding binary -buffersize 16 -translation crlf + fconfigure $f -translation binary -buffersize 16 -translation crlf puts $f "abcdefghijklmnopqrstuvwxyz" close $f contents $path(test1) @@ -210,7 +210,7 @@ test io-2.2 {WriteBytes: savedLF > 0} { # \n -> \r\n expansion. It gets stuck at beginning of this buffer. set f [open $path(test1) w] - fconfigure $f -encoding binary -buffersize 16 -translation crlf + fconfigure $f -translation binary -buffersize 16 -translation crlf puts -nonewline $f "123456789012345\n12" set x [list [contents $path(test1)]] close $f @@ -222,7 +222,7 @@ test io-2.3 {WriteBytes: flush on line} { # only up to the \n. set f [open $path(test1) w] - fconfigure $f -encoding binary -buffering line -translation crlf + fconfigure $f -translation binary -buffering line -translation crlf puts -nonewline $f "\n12" set x [contents $path(test1)] close $f @@ -230,8 +230,7 @@ test io-2.3 {WriteBytes: flush on line} { } "\r\n12" test io-2.4 {WriteBytes: reset sawLF after each buffer} { set f [open $path(test1) w] - fconfigure $f -encoding binary -buffering line -translation lf \ - -buffersize 16 + fconfigure $f -translation binary -buffering line -buffersize 16 puts -nonewline $f "abcdefg\nhijklmnopqrstuvwxyz" set x [list [contents $path(test1)]] close $f @@ -1115,7 +1114,7 @@ test io-7.2 {FilterInputBytes: split up character in middle of buffer} { # (bufPtr->nextAdded < bufPtr->bufLength) set f [open $path(test1) w] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f "1234567890\n123\x82\x4F\x82\x50\x82" close $f set f [open $path(test1)] @@ -1126,7 +1125,7 @@ test io-7.2 {FilterInputBytes: split up character in middle of buffer} { } [list 10 "1234567890" 0] test io-7.3 {FilterInputBytes: split up character at EOF} {testchannel} { set f [open $path(test1) w] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82" close $f set f [open $path(test1)] @@ -1139,7 +1138,7 @@ test io-7.3 {FilterInputBytes: split up character at EOF} {testchannel} { } [list 16 "123456789012301\x82" 18 0 1 -1 ""] test io-7.4 {FilterInputBytes: recover from split up character} {stdio fileevent} { set f [open "|[list [interpreter] $path(cat)]" w+] - fconfigure $f -encoding binary -buffering none + fconfigure $f -translation binary -buffering none puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82" fconfigure $f -encoding shiftjis -blocking 0 fileevent $f read [namespace code "ready $f"] @@ -1149,7 +1148,7 @@ test io-7.4 {FilterInputBytes: recover from split up character} {stdio fileevent lappend x [gets $f line] $line [fblocked $f] } vwait [namespace which -variable x] - fconfigure $f -encoding binary -blocking 1 + fconfigure $f -translation binary -blocking 1 puts $f "\x51\x82\x52" fconfigure $f -encoding shiftjis vwait [namespace which -variable x] @@ -1214,7 +1213,7 @@ test io-8.4 {PeekAhead: cached data available in this buffer} { puts $f "${a}\r\nabcdef" close $f set f [open $path(test1)] - fconfigure $f -encoding binary -translation auto + fconfigure $f -translation binary -translation auto # "${a}\r" was converted in one operation (because ENCODING_LINESIZE # is 30). To check if "\n" follows, calls PeekAhead and determines @@ -1331,7 +1330,7 @@ test io-11.1 {ReadBytes: want to read a lot} { puts -nonewline $f abcdefghijkl close $f set f [open $path(test1)] - fconfigure $f -encoding binary + fconfigure $f -translation binary # here set x [read $f 1000] close $f @@ -1344,7 +1343,7 @@ test io-11.2 {ReadBytes: want to read all} { puts -nonewline $f abcdefghijkl close $f set f [open $path(test1)] - fconfigure $f -encoding binary + fconfigure $f -translation binary # here set x [read $f] close $f @@ -1357,7 +1356,7 @@ test io-11.3 {ReadBytes: allocate more space} { puts -nonewline $f abcdefghijklmnopqrstuvwxyz close $f set f [open $path(test1)] - fconfigure $f -buffersize 16 -encoding binary + fconfigure $f -buffersize 16 -translation binary # here set x [read $f] close $f @@ -1370,7 +1369,7 @@ test io-11.4 {ReadBytes: EOF char found} { puts $f abcdefghijklmnopqrstuvwxyz close $f set f [open $path(test1)] - fconfigure $f -eofchar m -encoding binary + fconfigure $f -translation binary -eofchar m # here set x [list [read $f] [eof $f] [read $f] [eof $f]] close $f @@ -1418,7 +1417,7 @@ test io-12.4 {ReadChars: split-up char} {stdio testchannel fileevent} { # (srcRead == 0) set f [open "|[list [interpreter] $path(cat)]" w+] - fconfigure $f -encoding binary -buffering none -buffersize 16 + fconfigure $f -translation binary -buffering none -buffersize 16 puts -nonewline $f "123456789012345\x96" fconfigure $f -encoding shiftjis -blocking 0 @@ -1431,7 +1430,7 @@ test io-12.4 {ReadChars: split-up char} {stdio testchannel fileevent} { fconfigure $f -encoding shiftjis vwait [namespace which -variable x] - fconfigure $f -encoding binary -blocking 1 + fconfigure $f -translation binary -blocking 1 puts -nonewline $f "\x7B" after 500 ;# Give the cat process time to catch up fconfigure $f -encoding shiftjis -blocking 0 @@ -1441,7 +1440,7 @@ test io-12.4 {ReadChars: split-up char} {stdio testchannel fileevent} { } [list "123456789012345" 1 "本" 0] test io-12.5 {ReadChars: fileevents on partial characters} {stdio fileevent} { set path(test1) [makeFile { - fconfigure stdout -encoding binary -buffering none + fconfigure stdout -translation binary -buffering none gets stdin; puts -nonewline "\xE7" gets stdin; puts -nonewline "\x89" gets stdin; puts -nonewline "\xA6" @@ -4951,7 +4950,7 @@ test io-34.20 {Tcl_Tell combined with writing} { test io-34.21 {Tcl_Seek and Tcl_Tell on large files} {largefileSupport extensive} { file delete $path(test3) set f [open $path(test3) w] - fconfigure $f -encoding binary + fconfigure $f -translation binary set l "" lappend l [tell $f] puts -nonewline $f abcdef @@ -5342,9 +5341,9 @@ test io-36.1 {Tcl_InputBlocked on nonblocking pipe} stdio { } {{} 1 hello 0 {} 1} test io-36.1.1 {Tcl_InputBlocked on nonblocking binary pipe} stdio { set f1 [open "|[list [interpreter]]" r+] - chan configure $f1 -encoding binary -translation lf -eofchar {} + chan configure $f1 -translation binary puts $f1 { - chan configure stdout -encoding binary -translation lf -eofchar {} + chan configure stdout -translation binary puts hello_from_pipe } flush $f1 @@ -5687,7 +5686,7 @@ test io-39.13 {Tcl_SetChannelOption, Tcl_GetChannelOption, buffer size} { test io-39.14 {Tcl_SetChannelOption: -encoding, binary & utf-8} { file delete $path(test1) set f [open $path(test1) w] - fconfigure $f -encoding {} + fconfigure $f -translation binary puts -nonewline $f \xE7\x89\xA6 close $f set f [open $path(test1) r] @@ -5699,7 +5698,7 @@ test io-39.14 {Tcl_SetChannelOption: -encoding, binary & utf-8} { test io-39.15 {Tcl_SetChannelOption: -encoding, binary & utf-8} { file delete $path(test1) set f [open $path(test1) w] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f \xE7\x89\xA6 close $f set f [open $path(test1) r] @@ -5737,7 +5736,7 @@ test io-39.17 {Tcl_SetChannelOption: -encoding, clearing CHANNEL_NEED_MORE_DATA} vwait [namespace which -variable x] after 300 [namespace code { lappend x timeout }] vwait [namespace which -variable x] - fconfigure $f -encoding binary + fconfigure $f -translation binary vwait [namespace which -variable x] after 300 [namespace code { lappend x timeout }] vwait [namespace which -variable x] @@ -7543,7 +7542,6 @@ test io-52.10 {TclCopyChannel & encodings} -constraints {fcopy notWinCI} -body { set out [open $path(utf8-fcopy.txt) w] fconfigure $in -encoding koi8-r -translation lf - # -translation binary is also -encoding binary fconfigure $out -translation binary fcopy $in $out @@ -7565,7 +7563,6 @@ test io-52.11 {TclCopyChannel & encodings} -setup { set in [open $path(utf8-fcopy.txt) r] set out [open $path(kyrillic.txt) w] - # -translation binary is also -encoding binary fconfigure $in -translation binary fconfigure $out -encoding koi8-r -translation lf @@ -9243,7 +9240,7 @@ test io-74.1 {[104f2885bb] improper cache validity check} -setup { test io-75.1 {multibyte encoding error read results in raw bytes (-profile tcl8)} -setup { set fn [makeFile {} io-75.1] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation 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 @@ -9279,7 +9276,7 @@ test io-75.2 {unrepresentable character write passes and is replaced by ? (-prof test io-75.3 {incomplete multibyte encoding read is ignored (-profile tcl8)} -setup { set fn [makeFile {} io-75.3] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f "A\xC0" flush $f seek $f 0 @@ -9298,7 +9295,7 @@ test io-75.3 {incomplete multibyte encoding read is ignored (-profile tcl8)} -se test io-75.4 {shiftjis encoding error read results in raw bytes (-profile tcl8)} -setup { set fn [makeFile {} io-75.4] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # In shiftjis, \x81 starts a two-byte sequence. # But 2nd byte \xFF is not allowed puts -nonewline $f A\x81\xFFA @@ -9317,7 +9314,7 @@ test io-75.4 {shiftjis encoding error read results in raw bytes (-profile tcl8)} test io-75.5 {invalid utf-8 encoding read is ignored (-profile tcl8)} -setup { set fn [makeFile {} io-75.5] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f A\x81 flush $f seek $f 0 @@ -9334,7 +9331,7 @@ test io-75.5 {invalid utf-8 encoding read is ignored (-profile tcl8)} -setup { test io-75.6 {incomplete utf-8 encoding, blocking gets is not ignored (-profile strict)} -setup { set fn [makeFile {} io-75.6] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # \x81 is an incomplete byte sequence in utf-8 puts -nonewline $f A\x81 flush $f @@ -9352,7 +9349,7 @@ test io-75.6 {incomplete utf-8 encoding, blocking gets is not ignored (-profile test io-75.6.1 {invalid utf-8 encoding, blocking gets is not ignored (-profile strict)} -setup { set fn [makeFile {} io-75.6.1] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # utf-8: \xC3 requires a 2nd byte > x80, but <x80 is delivered puts -nonewline $f A\xC3B flush $f @@ -9370,7 +9367,7 @@ test io-75.6.1 {invalid utf-8 encoding, blocking gets is not ignored (-profile s test io-75.6.2 {invalid utf-8 encoding, blocking gets is not ignored (-profile strict), recover functionality} -setup { set fn [makeFile {} io-75.6.2] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # utf-8: \xC3 requires a 2nd byte > x80, but <x80 is delivered puts -nonewline $f A\xC3B flush $f @@ -9381,7 +9378,7 @@ test io-75.6.2 {invalid utf-8 encoding, blocking gets is not ignored (-profile s set l {} lappend l [catch {gets $f}] lappend l [tell $f] - fconfigure $f -encoding binary + fconfigure $f -translation binary lappend l [expr {[gets $f] eq "A\xC3B"}] } -cleanup { close $f @@ -9392,7 +9389,7 @@ test io-75.6.2 {invalid utf-8 encoding, blocking gets is not ignored (-profile s test io-75.6.3 {invalid utf-8 encoding, non blocking gets is not ignored (-profile strict)} -setup { set fn [makeFile {} io-75.6.3] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # utf-8: \xC3 requires a 2nd byte > x80, but <x80 is delivered puts -nonewline $f A\xC3B flush $f @@ -9410,7 +9407,7 @@ test io-75.6.3 {invalid utf-8 encoding, non blocking gets is not ignored (-profi test io-75.6.4 {incomplete utf-8 encoding, non blocking gets is not ignored (-profile strict)} -setup { set fn [makeFile {} io-75.6.4] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # \x81 is an incomplete byte sequence in utf-8 puts -nonewline $f A\x81 flush $f @@ -9432,7 +9429,7 @@ test io-75.7 { } -setup { set fn [makeFile {} io-75.7] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # \x81 is invalid in utf-8 puts -nonewline $f A\x81 flush $f @@ -9451,7 +9448,7 @@ test io-75.7 { test io-75.8 {invalid utf-8 encoding eof first handling (-profile strict)} -setup { set fn [makeFile {} io-75.8] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # \x81 is invalid in utf-8, but since \x1A comes first, -eofchar takes # precedence. puts -nonewline $f A\x1A\x81 @@ -9475,7 +9472,7 @@ test io-75.8.eoflater {invalid utf-8 encoding eof after handling (-profile stric set fn [makeFile {} io-75.8] set f [open $fn w+] # This also configures the channel encoding profile as strict. - fconfigure $f -encoding binary + fconfigure $f -translation binary # \x81 is invalid in utf-8. -eofchar is not detected, because it comes later. puts -nonewline $f A\x81\x81\x1A flush $f @@ -9502,7 +9499,7 @@ test io-strict-multibyte-eof { See issue 25cdcb7e8fb381fb } -setup { set chan [file tempfile]; - fconfigure $chan -encoding binary + fconfigure $chan -translation binary puts -nonewline $chan \x81\x1A flush $chan seek $chan 0 @@ -9537,7 +9534,7 @@ test io-75.9 {unrepresentable character write throws error in strict profile} -s test io-75.10 {incomplete multibyte encoding read is ignored} -setup { set fn [makeFile {} io-75.10] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f A\xC0 flush $f seek $f 0 @@ -9559,7 +9556,7 @@ test io-75.10 {incomplete multibyte encoding read is ignored} -setup { test io-75.11 {shiftjis encoding error read results in error (strict profile)} -setup { set fn [makeFile {} io-75.11] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # In shiftjis, \x81 starts a two-byte sequence. # But 2nd byte \xFF is not allowed puts -nonewline $f A\x81\xFFA @@ -9581,7 +9578,7 @@ test io-75.11 {shiftjis encoding error read results in error (strict profile)} - test io-75.12 {invalid utf-8 encoding read is ignored} -setup { set fn [makeFile {} io-75.12] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary puts -nonewline $f A\x81 flush $f seek $f 0 @@ -9601,7 +9598,7 @@ test io-75.13 { } -setup { set fn [makeFile {} io-75.13] set f [open $fn w+] - fconfigure $f -encoding binary + fconfigure $f -translation binary # \x81 is invalid in utf-8 puts -nonewline $f A\x81 flush $f @@ -9625,7 +9622,7 @@ test io-75.14 { invalid utf-8 encoding [gets] continues in non-strict mode after error } -setup { set chan [file tempfile] - fconfigure $chan -encoding binary + fconfigure $chan -translation binary # \xC0\n is an invalid utf-8 sequence puts -nonewline $chan a\nb\nc\xC0\nd\n flush $chan @@ -9653,7 +9650,7 @@ test io-75.15 { } -setup { set res {} set chan [file tempfile] - fconfigure $chan -encoding binary + fconfigure $chan -translation binary # \xC0\x40 is an invalid utf-8 sequence puts $chan hello\nAB\nCD\xC0\x40EF\nGHI seek $chan 0 |
