diff options
author | dgp <dgp@users.sourceforge.net> | 2014-10-02 14:46:54 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-10-02 14:46:54 (GMT) |
commit | e36d384130b5af708859589b4996dc23f9a82bf8 (patch) | |
tree | 20a24e30d261d0bdfb0cea41eb93b3bf9d58a336 /tests/io.test | |
parent | 78fcaa358001767a51161316acbc429666bf86dd (diff) | |
parent | 5e53c4c296a76474cabecdca52916f8608d84b2b (diff) | |
download | tcl-e36d384130b5af708859589b4996dc23f9a82bf8.zip tcl-e36d384130b5af708859589b4996dc23f9a82bf8.tar.gz tcl-e36d384130b5af708859589b4996dc23f9a82bf8.tar.bz2 |
[bc5b790099] Improper calculation of new dstLimit value. New test io-12.7.
Diffstat (limited to 'tests/io.test')
-rw-r--r-- | tests/io.test | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test index 639691a..a030200 100644 --- a/tests/io.test +++ b/tests/io.test @@ -1484,6 +1484,39 @@ test io-12.6 {ReadChars: too many chars read} { } close $c } {} +test io-12.7 {ReadChars: too many chars read [bc5b790099]} { + proc driver {cmd args} { + variable buffer + variable index + set chan [lindex $args 0] + switch -- $cmd { + initialize { + set index($chan) 0 + set buffer($chan) [encoding convertto utf-8 \ + [string repeat \uBEEF 10]....\uBEEF] + return {initialize finalize watch read} + } + finalize { + unset index($chan) buffer($chan) + return + } + watch {} + read { + set n [lindex $args 1] + set new [expr {$index($chan) + $n}] + set result [string range $buffer($chan) $index($chan) $new-1] + set index($chan) $new + return $result + } + } + } + set c [chan create read [namespace which driver]] + chan configure $c -encoding utf-8 + while {![eof $c]} { + read $c 7 + } + close $c +} {} test io-13.1 {TranslateInputEOL: cr mode} {} { set f [open $path(test1) w] |