summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-02-26 20:28:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-02-26 20:28:36 (GMT)
commitf19d1d8d965902850bb0049aed2dd43abc0e7d29 (patch)
treeac04c85423acd819613e7b0eb50bda261374b6b2 /tests/io.test
parente3adf1d9a076bcb2704e4364c50097b49e6348c5 (diff)
parent5a1cac2f139731c8a4cacfc7dce7b8c456e860f4 (diff)
downloadtcl-f19d1d8d965902850bb0049aed2dd43abc0e7d29.zip
tcl-f19d1d8d965902850bb0049aed2dd43abc0e7d29.tar.gz
tcl-f19d1d8d965902850bb0049aed2dd43abc0e7d29.tar.bz2
merge 8.5
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 6f4877f..0941e02 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