diff options
author | dgp <dgp@users.sourceforge.net> | 2004-11-18 19:22:07 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-11-18 19:22:07 (GMT) |
commit | 4e5e1d3ec698a9eb79f0201885584f3f8d233d35 (patch) | |
tree | b799cc820fa33ab33c4d999c17c6882513c0865e /tests/socket.test | |
parent | 3727bd7f9afd5d6505ad727831ed2afc3723c316 (diff) | |
download | tcl-4e5e1d3ec698a9eb79f0201885584f3f8d233d35.zip tcl-4e5e1d3ec698a9eb79f0201885584f3f8d233d35.tar.gz tcl-4e5e1d3ec698a9eb79f0201885584f3f8d233d35.tar.bz2 |
* tests/basic.test: Updated functional (not testing) uses of
* tests/io.test: [bgerror] to make use of [interp bgerror].
* tests/socket.test:
* tests/timer.test:
* generic/tclInterp.c: Corrected [interp bgerror] error message.
Diffstat (limited to 'tests/socket.test')
-rw-r--r-- | tests/socket.test | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/tests/socket.test b/tests/socket.test index 8b6e383..27d95af 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: socket.test,v 1.35 2004/11/04 00:23:52 dgp Exp $ +# RCS: @(#) $Id: socket.test,v 1.36 2004/11/18 19:22:14 dgp Exp $ # Running socket tests with a remote server: # ------------------------------------------ @@ -769,8 +769,14 @@ test socket-5.3 {byte order problems, socket numbers, htons} \ set x } {couldn't open socket: not owner} -test socket-6.1 {accept callback error} {socket stdio} { +test socket-6.1 {accept callback error} -constraints {socket stdio} -setup { + proc myHandler {msg options} { + variable x $msg + } + set handler [interp bgerror {}] + interp bgerror {} [namespace which myHandler] file delete $path(script) +} -body { set f [open $path(script) w] puts $f { gets stdin port @@ -778,10 +784,6 @@ test socket-6.1 {accept callback error} {socket stdio} { } close $f set f [open "|[list [interpreter] $path(script)]" r+] - proc bgerror args { - global x - set x $args - } proc accept {s a p} {expr 10 / 0} set s [socket -server accept 0] puts $f [lindex [fconfigure $s -sockname] 2] @@ -790,9 +792,10 @@ test socket-6.1 {accept callback error} {socket stdio} { vwait x after cancel $timer close $s - rename bgerror {} set x -} {{divide by zero}} +} -cleanup { + interp bgerror {} $handler +} -result {divide by zero} test socket-7.1 {testing socket specific options} {socket stdio} { file delete $path(script) @@ -1043,9 +1046,16 @@ test socket-9.3 {testing EOF stickyness} {socket} { removeFile script -test socket-10.1 {testing socket accept callback error handling} {socket} { - set goterror 0 - proc bgerror args {global goterror; set goterror 1} +test socket-10.1 {testing socket accept callback error handling} -constraints { + socket +} -setup { + variable goterror 0 + proc myHandler {msg options} { + variable goterror 1 + } + set handler [interp bgerror {}] + interp bgerror {} [namespace which myHandler] +} -body { set s [socket -server accept 0] proc accept {s a p} {close $s; error} set c [socket 127.0.0.1 [lindex [fconfigure $s -sockname] 2]] @@ -1053,7 +1063,9 @@ test socket-10.1 {testing socket accept callback error handling} {socket} { close $s close $c set goterror -} 1 +} -cleanup { + interp bgerror {} $handler +} -result 1 test socket-11.1 {tcp connection} {socket doTestsWithRemoteServer} { sendCommand { @@ -1228,13 +1240,17 @@ test socket-11.8 {client with several servers} {socket doTestsWithRemoteServer} } set l } {4003 {} 1 4004 {} 1 4005 {} 1} -test socket-11.9 {accept callback error} {socket doTestsWithRemoteServer} { +test socket-11.9 {accept callback error} -constraints { + socket doTestsWithRemoteServer +} -setup { + proc myHandler {msg options} { + variable x $msg + } + set handler [interp bgerror {}] + interp bgerror {} [namespace which myHandler] +} -body { set s [socket -server accept 2836] proc accept {s a p} {expr 10 / 0} - proc bgerror args { - global x - set x $args - } if {[catch {sendCommand { set peername [fconfigure $callerSocket -peername] set s [socket [lindex $peername 0] 2836] @@ -1247,9 +1263,10 @@ test socket-11.9 {accept callback error} {socket doTestsWithRemoteServer} { vwait x after cancel $timer close $s - rename bgerror {} set x -} {{divide by zero}} +} -cleanup { + interp bgerror {} $handler +} -result {divide by zero} test socket-11.10 {testing socket specific options} {socket doTestsWithRemoteServer} { sendCommand { set socket10_12_test_server [socket -server accept 2836] |