summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-02-26 11:26:00 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-02-26 11:26:00 (GMT)
commite3adf1d9a076bcb2704e4364c50097b49e6348c5 (patch)
tree39f33d382a1fb544842a56dc668a70accfed9e28
parentc7f19f76c5362c2918fe01d49808b3246fd84100 (diff)
downloadtcl-e3adf1d9a076bcb2704e4364c50097b49e6348c5.zip
tcl-e3adf1d9a076bcb2704e4364c50097b49e6348c5.tar.gz
tcl-e3adf1d9a076bcb2704e4364c50097b49e6348c5.tar.bz2
More coverage tests and bug fixes.
-rw-r--r--generic/tclIO.c3
-rw-r--r--tests/io.test56
2 files changed, 57 insertions, 2 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index a73f041..c2a8cab 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -5644,7 +5644,7 @@ TranslateInputEOL(
SetFlag(statePtr, CHANNEL_EOF | CHANNEL_STICKY_EOF);
statePtr->inputEncodingFlags |= TCL_ENCODING_END;
- ResetFlag(statePtr, INPUT_SAW_CR | INPUT_NEED_NL);
+// ResetFlag(statePtr, INPUT_SAW_CR | INPUT_NEED_NL);
return 1;
}
@@ -8981,7 +8981,6 @@ CopyAndTranslateBuffer(
if (statePtr->inEofChar != 0) {
int i;
- Tcl_Panic("Untested");
for (i = 0; i < copied; i++) {
if (result[i] == (char) statePtr->inEofChar) {
/*
diff --git a/tests/io.test b/tests/io.test
index 8c066ca..6f4877f 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -6786,6 +6786,62 @@ test io-52.15 {coverage of -translation crlf} {
close $out
file size $path(test2)
} 8
+test io-52.16 {coverage of eofChar handling} {
+ file delete $path(test1) $path(test2)
+ set out [open $path(test1) wb]
+ chan configure $out -translation lf
+ puts -nonewline $out abcdefg\rhijklmn\nopqrstu\r\nvwxyz
+ close $out
+ set in [open $path(test1)]
+ chan configure $in -buffersize 8 -translation lf -eofchar a
+ set out [open $path(test2) w]
+ fcopy $in $out
+ close $in
+ close $out
+ file size $path(test2)
+} 0
+test io-52.17 {coverage of eofChar handling} {
+ file delete $path(test1) $path(test2)
+ set out [open $path(test1) wb]
+ chan configure $out -translation lf
+ puts -nonewline $out abcdefg\rhijklmn\nopqrstu\r\nvwxyz
+ close $out
+ set in [open $path(test1)]
+ chan configure $in -buffersize 8 -translation lf -eofchar d
+ set out [open $path(test2) w]
+ fcopy $in $out
+ close $in
+ close $out
+ file size $path(test2)
+} 3
+test io-52.18 {coverage of eofChar handling} {
+ file delete $path(test1) $path(test2)
+ set out [open $path(test1) wb]
+ chan configure $out -translation lf
+ puts -nonewline $out abcdefg\rhijklmn\nopqrstu\r\nvwxyz
+ close $out
+ set in [open $path(test1)]
+ chan configure $in -buffersize 8 -translation crlf -eofchar h
+ set out [open $path(test2) w]
+ fcopy $in $out
+ close $in
+ close $out
+ file size $path(test2)
+} 8
+test io-52.19 {coverage of eofChar handling} {
+ file delete $path(test1) $path(test2)
+ set out [open $path(test1) wb]
+ chan configure $out -translation lf
+ puts -nonewline $out abcdefg\rhijklmn\nopqrstu\r\nvwxyz
+ close $out
+ set in [open $path(test1)]
+ chan configure $in -buffersize 10 -translation crlf -eofchar h
+ set out [open $path(test2) w]
+ fcopy $in $out
+ close $in
+ close $out
+ file size $path(test2)
+} 8
test io-53.1 {CopyData} {fcopy} {
file delete $path(test1)