From 49f09ae8c228ad19029f35a4f40ba6dc6c5d5fff Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 22 Jul 2022 17:36:57 +0000 Subject: extends test io-29.36.2 for better illustration when we'll get extra NL - if no "\r" in last buffer, so only EOF causes exit from gets (flag INPUT_SAW_CR gets reset incorrectly) --- tests/io.test | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/io.test b/tests/io.test index 8df28ba..3b374c1 100644 --- a/tests/io.test +++ b/tests/io.test @@ -3054,11 +3054,15 @@ test io-29.36.2 {gets on translation auto with "\r\n" in different buffers, bug } else { # we don't have a delay, so client would get the lines as single chunk } + # we'll try with "\r" and without "\r" (to cover both branches, where "\r" and "eof" causes exit from [gets] by 3rd line) puts -nonewline $so "\n3 line" + if {!($::cnt % 3)} { + puts -nonewline $so "\r" + } flush $so close $so } - while {$::cnt < 4} { incr ::cnt + while {$::cnt < 6} { incr ::cnt set c [socket 127.0.0.1 [lindex [fconfigure $s -sockname] 2]] fconfigure $c -blocking 0 -buffering line -translation auto fileevent $c readable [list apply {c { @@ -3076,7 +3080,7 @@ test io-29.36.2 {gets on translation auto with "\r\n" in different buffers, bug close $s if {$c ne {}} { close $c } unset -nocomplain ::done ::cli ::cnt s c -} -result [lrepeat 4 {<1 line>} {<2 line>} {<3 line>}] +} -result [lrepeat 6 {<1 line>} {<2 line>} {<3 line>}] # Test end of line translations. Procedures tested are Tcl_Write, Tcl_Read. -- cgit v0.12