summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authormax <max@tclers.tk>2022-08-04 15:09:59 (GMT)
committermax <max@tclers.tk>2022-08-04 15:09:59 (GMT)
commit7c269c207f4a9c13dd64edea5fa799a5d952742c (patch)
tree5295289ce73f0a5343180f98a817d2788054330e /tests/io.test
parent333f084b63b2fabca453da486b7879e1b6b6cf51 (diff)
downloadtcl-7c269c207f4a9c13dd64edea5fa799a5d952742c.zip
tcl-7c269c207f4a9c13dd64edea5fa799a5d952742c.tar.gz
tcl-7c269c207f4a9c13dd64edea5fa799a5d952742c.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 3b374c1..0a34019 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -330,6 +330,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