summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-11-06 14:52:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-11-06 14:52:36 (GMT)
commit06fa92e9a424d57ed4c9458474f5f8a7b42cc654 (patch)
tree076f9dfd4dfdd34ea8bbd6f768566b12832e23b9
parent7cc4c83aed245ab7ec48a2d037c43b8b59cfdddb (diff)
downloadtcl-06fa92e9a424d57ed4c9458474f5f8a7b42cc654.zip
tcl-06fa92e9a424d57ed4c9458474f5f8a7b42cc654.tar.gz
tcl-06fa92e9a424d57ed4c9458474f5f8a7b42cc654.tar.bz2
Another test checking that handling when transform returns nothing is right.
-rw-r--r--tests/ioTrans.test36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/ioTrans.test b/tests/ioTrans.test
index faae9d8..aa2fbc7 100644
--- a/tests/ioTrans.test
+++ b/tests/ioTrans.test
@@ -676,7 +676,7 @@ test iortrans-4.10.2 {[5adbc350683] chan read, handle fleeting EOF} -body {
rename idxform {}
-# Channel read transform that delays the data
+# Channel read transform that delays the data and always returns something
proc delayxform {cmd handle args} {
variable store
switch -- $cmd {
@@ -732,6 +732,40 @@ test iortrans-4.11.2 {[5adbc350683] chan read, handle fleeting EOF} -body {
} -result {0 ..... 1 {} 0 ..... 1}
rename delayxform {}
+
+# Channel read transform that delays the data and may return {}
+ proc delay2xform {cmd handle args} {
+ variable store
+ switch -- $cmd {
+ initialize {
+ set store($handle) {}
+ return {initialize finalize read drain}
+ }
+ finalize {
+ unset store($handle)
+ return
+ }
+ read {
+ lassign $args buffer
+ set reply $store($handle)
+ set store($handle) $buffer
+ return $reply
+ }
+ drain {
+ delay2xform read $handle {}
+ }
+ }
+ }
+
+test iortrans-4.12 {[5adbc350683] chan read, handle fleeting EOF} -body {
+ set chan [chan push [chan create read driver] delay2xform]
+ list [eof $chan] [read $chan] [eof $chan] [read $chan 0] [eof $chan] \
+ [read $chan] [eof $chan]
+} -cleanup {
+ close $chan
+} -result {0 ..... 1 {} 0 ..... 1}
+
+ rename delay2xform {}
rename driver {}