summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authormax <max@tclers.tk>2022-08-04 15:26:18 (GMT)
committermax <max@tclers.tk>2022-08-04 15:26:18 (GMT)
commit228c1134e28746ff7ea71d582ce3b80e68fe030a (patch)
treef00d98d464e4f894b940844c2809f5835aca4b4b /tests/io.test
parent2da979cd8e0bfb96bc57578f2ff2413efd393e5c (diff)
parent7c269c207f4a9c13dd64edea5fa799a5d952742c (diff)
downloadtcl-228c1134e28746ff7ea71d582ce3b80e68fe030a.zip
tcl-228c1134e28746ff7ea71d582ce3b80e68fe030a.tar.gz
tcl-228c1134e28746ff7ea71d582ce3b80e68fe030a.tar.bz2
Fix a case of lf not being flushed in certain cases when the crlf sequence gets split across two buffers on channels in crlf mode with line buffering [https://core.tcl-lang.org/tcllib/tktview?name=c9d8a52fe]
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index dca88a4..6314ace 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -336,6 +336,15 @@ test io-3.8 {WriteChars: reset sawLF after each buffer} {
close $f
lappend x [contents $path(test1)]
} [list "abcdefg\nhijklmno" "abcdefg\nhijklmnopqrstuvwxyz"]
+test io-3.9 {Write: flush line-buffered channels when crlf is split over two buffers} -body {
+ # https://core.tcl-lang.org/tcllib/tktedit?name=c9d8a52fe
+ set f [open $path(test1) w]
+ fconfigure $f -buffering line -translation crlf -buffersize 8
+ puts $f "1234567"
+ string map {"\r" "<cr>" "\n" "<lf>"} [contents $path(test1)]
+} -cleanup {
+ close $f
+} -result "1234567<cr><lf>"
test io-4.1 {TranslateOutputEOL: lf} {
# search for \n