summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-04-24 20:17:12 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-04-24 20:17:12 (GMT)
commit86985bc264038f13e0e7ee2168047a97aec92464 (patch)
tree8683c744d7b2bc7e8da6b207a43b7ca4e574a861 /tests
parentd5453f4a90c64ff9ea80c89e8e7c4b51e7f26d16 (diff)
parent699e28e6b71c712ca43904df96a044f8c9594ec8 (diff)
downloadtcl-86985bc264038f13e0e7ee2168047a97aec92464.zip
tcl-86985bc264038f13e0e7ee2168047a97aec92464.tar.gz
tcl-86985bc264038f13e0e7ee2168047a97aec92464.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')
-rw-r--r--tests/io.test52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index 06ae81d..4e1af72 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -1517,6 +1517,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]
@@ -8542,6 +8575,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