summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-10-10 19:02:37 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-10-10 19:02:37 (GMT)
commit1f33c7ae12c829e870b7bf7ac5db2a49ae551701 (patch)
treefaa64f8d5edd8550dafbb2e3e3362f29d32d8cbb /tests/io.test
parent78c2c1cedf0cf9a971c5ab6fe926bc0621e824ce (diff)
downloadtcl-1f33c7ae12c829e870b7bf7ac5db2a49ae551701.zip
tcl-1f33c7ae12c829e870b7bf7ac5db2a49ae551701.tar.gz
tcl-1f33c7ae12c829e870b7bf7ac5db2a49ae551701.tar.bz2
Another test so both DoRead and MBRead are covered.
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index b657999..d9a5167 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -7752,6 +7752,50 @@ test io-53.15 {[ed29c4da21] DoRead: fblocked seen as error} -setup {
close $c
removeFile out
} -result 100
+test io-53.16 {[ed29c4da21] MBRead: fblocked seen as error} -setup {
+ proc driver {cmd args} {
+ variable buffer
+ variable index
+ variable blocked
+ set chan [lindex $args 0]
+ switch -- $cmd {
+ initialize {
+ set index($chan) 0
+ set buffer($chan) [encoding convertto utf-8 \
+ [string repeat a 100]]
+ set blocked($chan) 1
+ return {initialize finalize watch read}
+ }
+ finalize {
+ unset index($chan) buffer($chan) blocked($chan)
+ return
+ }
+ watch {}
+ read {
+ if {$blocked($chan)} {
+ set blocked($chan) [expr {!$blocked($chan)}]
+ return -code error EAGAIN
+ }
+ set n [lindex $args 1]
+ set new [expr {$index($chan) + $n}]
+ set result [string range $buffer($chan) $index($chan) $new-1]
+ set index($chan) $new
+ return $result
+ }
+ }
+ }
+ set c [chan create read [namespace which driver]]
+ chan configure $c -encoding utf-8 -translation lf
+ set out [makeFile {} out]
+ set outChan [open $out w]
+ chan configure $outChan -encoding utf-8 -translation lf
+} -body {
+ chan copy $c $outChan
+} -cleanup {
+ close $outChan
+ close $c
+ removeFile out
+} -result 100
test io-54.1 {Recursive channel events} {socket fileevent} {
# This test checks to see if file events are delivered during recursive