diff options
author | dgp <dgp@users.sourceforge.net> | 2014-12-18 18:06:51 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-12-18 18:06:51 (GMT) |
commit | f1da0fefc6ab7f421a081f26b052cd5116c819e6 (patch) | |
tree | dae33b4dc113e43a01da394e30ff4ddc4dfafec7 /tests/io.test | |
parent | 80de73ed3bcd1b495c61c04383f63e77b3aded7d (diff) | |
download | tcl-f1da0fefc6ab7f421a081f26b052cd5116c819e6.zip tcl-f1da0fefc6ab7f421a081f26b052cd5116c819e6.tar.gz tcl-f1da0fefc6ab7f421a081f26b052cd5116c819e6.tar.bz2 |
[7c187a3773] Fix error in managing inStatePtr->inQueueTail value in the
byte-moving optimized path of [chan copy]. Thanks to Benno.
Diffstat (limited to 'tests/io.test')
-rw-r--r-- | tests/io.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test index b09d55a..cd8b014 100644 --- a/tests/io.test +++ b/tests/io.test @@ -7900,6 +7900,44 @@ test io-53.16 {[ed29c4da21] MBRead: fblocked seen as error} -setup { close $c removeFile out } -result 100 +test io-53.17 {[7c187a3773] MBWrite: proper inQueueTail handling} -setup { + 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 \ + line\n[string repeat a 100]line\n] + 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 -translation lf -buffersize 107 + set out [makeFile {} out] + set outChan [open $out w] + chan configure $outChan -encoding utf-8 -translation lf +} -body { + list [gets $c] [chan copy $c $outChan -size 100] [gets $c] +} -cleanup { + close $outChan + close $c + removeFile out +} -result {line 100 line} test io-54.1 {Recursive channel events} {socket fileevent} { # This test checks to see if file events are delivered during recursive |