diff options
author | dgp <dgp@users.sourceforge.net> | 2014-11-06 15:06:52 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-11-06 15:06:52 (GMT) |
commit | 5c6717b7d59cd081a7e24a588756c9c14aa4c555 (patch) | |
tree | 54df6c08d6f20cf0ffb48f14021bb4c2dbb7e146 /tests | |
parent | db9946ccc33f61d984372c7f76375248cacde6de (diff) | |
download | tcl-5c6717b7d59cd081a7e24a588756c9c14aa4c555.zip tcl-5c6717b7d59cd081a7e24a588756c9c14aa4c555.tar.gz tcl-5c6717b7d59cd081a7e24a588756c9c14aa4c555.tar.bz2 |
New test iogt-7.0 demos bug in [testchannel transform].
Diffstat (limited to 'tests')
-rw-r--r-- | tests/iogt.test | 42 |
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] { |