summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-11-06 15:06:52 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-11-06 15:06:52 (GMT)
commita8c6a73058b823dbb1ea5e3832d016284820400e (patch)
tree54df6c08d6f20cf0ffb48f14021bb4c2dbb7e146
parent5a0bdb1baf6c35b490aa2d34d5ea5aec3ae66831 (diff)
downloadtcl-a8c6a73058b823dbb1ea5e3832d016284820400e.zip
tcl-a8c6a73058b823dbb1ea5e3832d016284820400e.tar.gz
tcl-a8c6a73058b823dbb1ea5e3832d016284820400e.tar.bz2
New test iogt-7.0 demos bug in [testchannel transform].
-rw-r--r--tests/iogt.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/iogt.test b/tests/iogt.test
index 5fe3dc2..1a18afc 100644
--- a/tests/iogt.test
+++ b/tests/iogt.test
@@ -996,6 +996,48 @@ test iogt-6.1 {Push back and up} {testchannel knownBug} {
set res
} {xxxghi}
+# Driver for a base channel that emits several short "files"
+# with each terminated by a fleeting EOF
+ proc driver {cmd args} {
+ variable buffer
+ variable index
+ set chan [lindex $args 0]
+ switch -- $cmd {
+ initialize {
+ set index($chan) 0
+ set buffer($chan) .....
+ return {initialize finalize watch read}
+ }
+ finalize {
+ if {![info exists index($chan)]} {return}
+ unset index($chan) buffer($chan)
+ return
+ }
+ watch {}
+ read {
+ set n [lindex $args 1]
+ if {![info exists index($chan)]} {
+ driver initialize $chan
+ }
+ set new [expr {$index($chan) + $n}]
+ set result [string range $buffer($chan) $index($chan) $new-1]
+ set index($chan) $new
+ if {[string length $result] == 0} {
+ driver finalize $chan
+ }
+ return $result
+ }
+ }
+ }
+
+test iogt-7.0 {Handle fleeting EOF} -constraints {testchannel} -body {
+ set chan [chan create read [namespace which driver]]
+ identity -attach $chan
+ list [eof $chan] [read $chan] [eof $chan] [read $chan 0] [eof $chan] \
+ [read $chan] [eof $chan]
+} -cleanup {
+ close $chan
+} -result {0 ..... 1 {} 0 ..... 1}
# cleanup
foreach file [list dummy dummyout __echo_srv__.tcl] {