summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/socket.test17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/socket.test b/tests/socket.test
index 218cce4..a3d4b4b 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -67,6 +67,10 @@ namespace import -force ::tcltest::*
testConstraint testthread [llength [info commands testthread]]
testConstraint exec [llength [info commands exec]]
+# Produce a random port number in the Dynamic/Private range
+# from 49152 through 65535.
+proc randport {} { expr {int(rand()*16383+49152)} }
+
# If remoteServerIP or remoteServerPort are not set, check in the
# environment variables for externally set values.
#
@@ -926,6 +930,19 @@ test socket-8.2 {testing writable event when quick failure} {socket win} {
set x
} writable
+test socket-8.3 {testing fileevent readable on failed async socket connect} {socket} {
+ # Test for bug 581937ab1e
+
+ set a1 [after 5000 {set x timeout}]
+ # This connect should fail
+ set s [socket -async localhost [randport]]
+ fileevent $s readable {set x readable}
+ vwait x
+ catch {close $s}
+ after cancel $a1
+ set x
+} readable
+
test socket-9.1 {testing spurious events} {socket} {
set len 0
set spurious 0