summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-04-24 20:06:27 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-04-24 20:06:27 (GMT)
commit5ecd3fa2b65f897feccd280c1a04ca9f8f7c6f0a (patch)
tree082e4ddcc59228a564e2c2b8efe57ab94a0b31de /tests/io.test
parentae445193f4014a405dad671de52f4b4aae4959d9 (diff)
downloadtcl-5ecd3fa2b65f897feccd280c1a04ca9f8f7c6f0a.zip
tcl-5ecd3fa2b65f897feccd280c1a04ca9f8f7c6f0a.tar.gz
tcl-5ecd3fa2b65f897feccd280c1a04ca9f8f7c6f0a.tar.bz2
[879a0747be] Repair handling of incomplete multi-byte chars at the ends
of input buffers. Also properly reset input encoding flags when cycling through a fleeting EOF condition.
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index e4dc522..d199206 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -1511,6 +1511,39 @@ test io-12.7 {ReadChars: too many chars read [bc5b790099]} {
}
close $c
} {}
+test io-12.8 {ReadChars: multibyte chars split} {
+ set f [open $path(test1) w]
+ fconfigure $f -translation binary
+ puts -nonewline $f [string repeat a 9]\xc2\xa0
+ close $f
+ set f [open $path(test1)]
+ fconfigure $f -encoding utf-8 -buffersize 10
+ set in [read $f]
+ close $f
+ scan [string index $in end] %c
+} 160
+test io-12.9 {ReadChars: multibyte chars split} {
+ set f [open $path(test1) w]
+ fconfigure $f -translation binary
+ puts -nonewline $f [string repeat a 9]\xc2
+ close $f
+ set f [open $path(test1)]
+ fconfigure $f -encoding utf-8 -buffersize 10
+ set in [read $f]
+ close $f
+ scan [string index $in end] %c
+} 194
+test io-12.10 {ReadChars: multibyte chars split} {
+ set f [open $path(test1) w]
+ fconfigure $f -translation binary
+ puts -nonewline $f [string repeat a 9]\xc2
+ close $f
+ set f [open $path(test1)]
+ fconfigure $f -encoding utf-8 -buffersize 11
+ set in [read $f]
+ close $f
+ scan [string index $in end] %c
+} 194
test io-13.1 {TranslateInputEOL: cr mode} {} {
set f [open $path(test1) w]
@@ -8438,6 +8471,25 @@ test io-73.4 {[5adc350683] [read] after EOF} -setup {
} -result {1 1 {more data
} 1}
+test io-73.5 {effect of eof on encoding end flags} -setup {
+ set fn [makeFile {} io-73.5]
+ set rfd [open $fn r]
+ set wfd [open $fn a]
+ chan configure $wfd -buffering none -translation binary
+ chan configure $rfd -buffersize 5 -encoding utf-8
+ read $rfd
+} -body {
+ set result [eof $rfd]
+ puts -nonewline $wfd "more\u00c2\u00a0data"
+ lappend result [eof $rfd]
+ lappend result [read $rfd]
+ lappend result [eof $rfd]
+} -cleanup {
+ close $wfd
+ close $rfd
+ removeFile io-73.5
+} -result [list 1 1 more\u00a0data 1]
+
# ### ### ### ######### ######### #########
# cleanup