diff options
author | dgp <dgp@users.sourceforge.net> | 2015-04-24 20:06:27 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2015-04-24 20:06:27 (GMT) |
commit | 699e28e6b71c712ca43904df96a044f8c9594ec8 (patch) | |
tree | 082e4ddcc59228a564e2c2b8efe57ab94a0b31de /tests/io.test | |
parent | 9c7addd0fee93ed5ccdf1faeccf7994924e2d6ca (diff) | |
download | tcl-699e28e6b71c712ca43904df96a044f8c9594ec8.zip tcl-699e28e6b71c712ca43904df96a044f8c9594ec8.tar.gz tcl-699e28e6b71c712ca43904df96a044f8c9594ec8.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.test | 52 |
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 |