summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-02-26 17:47:46 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-02-26 17:47:46 (GMT)
commit5a1cac2f139731c8a4cacfc7dce7b8c456e860f4 (patch)
treeb6267039f96913b1a6e3c6fc751ac94ae46b1f79 /tests/io.test
parentbc47ed9728afc2b9554570326e2afe173fae22d7 (diff)
downloadtcl-5a1cac2f139731c8a4cacfc7dce7b8c456e860f4.zip
tcl-5a1cac2f139731c8a4cacfc7dce7b8c456e860f4.tar.gz
tcl-5a1cac2f139731c8a4cacfc7dce7b8c456e860f4.tar.bz2
New tests covering INPUT_NEED_NL flag handling. One exposes a bug.
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index 68051d7..64c878d 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -4701,6 +4701,77 @@ test io-35.17 {Tcl_Eof, eof char in middle, crlf write, crlf read} {
close $f
list $c $l $e
} {21 8 1}
+test io-35.18 {Tcl_Eof, eof char, cr write, crlf read} {
+ file delete $path(test1)
+ set f [open $path(test1) w]
+ fconfigure $f -translation cr
+ puts $f abc\ndef
+ close $f
+ set s [file size $path(test1)]
+ set f [open $path(test1) r]
+ fconfigure $f -translation crlf
+ set l [string length [set in [read $f]]]
+ set e [eof $f]
+ close $f
+ list $s $l $e [scan [string index $in end] %c]
+} {8 8 1 13}
+test io-35.18a {Tcl_Eof, eof char, cr write, crlf read} {
+ file delete $path(test1)
+ set f [open $path(test1) w]
+ fconfigure $f -translation cr -eofchar \x1a
+ puts $f abc\ndef
+ close $f
+ set s [file size $path(test1)]
+ set f [open $path(test1) r]
+ fconfigure $f -translation crlf -eofchar \x1a
+ set l [string length [set in [read $f]]]
+ set e [eof $f]
+ close $f
+ list $s $l $e [scan [string index $in end] %c]
+} {9 8 1 13}
+test io-35.18b {Tcl_Eof, eof char, cr write, crlf read} {
+ file delete $path(test1)
+ set f [open $path(test1) w]
+ fconfigure $f -translation cr -eofchar \x1a
+ puts $f {}
+ close $f
+ set s [file size $path(test1)]
+ set f [open $path(test1) r]
+ fconfigure $f -translation crlf -eofchar \x1a
+ set l [string length [set in [read $f]]]
+ set e [eof $f]
+ close $f
+ list $s $l $e [scan [string index $in end] %c]
+} {2 1 1 13}
+test io-35.18c {Tcl_Eof, eof char, cr write, crlf read} {
+ file delete $path(test1)
+ set f [open $path(test1) w]
+ fconfigure $f -translation cr
+ puts $f {}
+ close $f
+ set s [file size $path(test1)]
+ set f [open $path(test1) r]
+ fconfigure $f -translation crlf
+ set l [string length [set in [read $f]]]
+ set e [eof $f]
+ close $f
+ list $s $l $e [scan [string index $in end] %c]
+} {1 1 1 13}
+test io-35.19 {Tcl_Eof, eof char in middle, cr write, crlf read} {
+ file delete $path(test1)
+ set f [open $path(test1) w]
+ fconfigure $f -translation cr -eofchar {}
+ set i [format abc\ndef\n%cqrs\nuvw 26]
+ puts $f $i
+ close $f
+ set c [file size $path(test1)]
+ set f [open $path(test1) r]
+ fconfigure $f -translation crlf -eofchar \x1a
+ set l [string length [set in [read $f]]]
+ set e [eof $f]
+ close $f
+ list $c $l $e [scan [string index $in end] %c]
+} {17 8 1 13}
# Test Tcl_InputBlocked