summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/io.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index 2b6670f..1cde686 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -5125,6 +5125,51 @@ test io-33.1 {ChannelTimerProc} {
lappend result $y
} {2 done}
+test io-34.1 {buffered data and file events, gets} {
+ proc accept {sock args} {
+ set ::s2 $sock
+ }
+ set server [socket -server accept 4040]
+ set s [socket localhost 4040]
+ vwait s2
+ update
+ fileevent $s2 readable {lappend result readable}
+ puts $s "12\n34567890"
+ flush $s
+ set result [gets $s2]
+ after 1000 {lappend result timer}
+ vwait result
+ lappend result [gets $s2]
+ vwait result
+ close $s
+ close $s2
+ close $server
+ set result
+} {12 readable 34567890 timer}
+test io-34.2 {buffered data and file events, read} {
+ proc accept {sock args} {
+ set ::s2 $sock
+ }
+ set server [socket -server accept 4040]
+ set s [socket localhost 4040]
+ vwait s2
+ update
+ fileevent $s2 readable {lappend result readable}
+ puts -nonewline $s "1234567890"
+ flush $s
+ set result [read $s2 1]
+ after 1000 {lappend result timer}
+ vwait result
+ lappend result [read $s2 9]
+ vwait result
+ close $s
+ close $s2
+ close $server
+ set result
+} {1 readable 234567890 timer}
+
+
+
removeFile fooBar
removeFile longfile
removeFile script