1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-
+
|
# This file contains a collection of tests for the procedures in the file
# tclEvent.c, which includes the "update", and "vwait" Tcl
# commands. Sourcing this file into Tcl runs the tests and generates
# output for errors. No output means no errors were found.
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: event.test,v 1.20.4.2 2007/04/08 14:59:42 dgp Exp $
# RCS: @(#) $Id: event.test,v 1.20.4.3 2007/09/07 20:21:18 dgp Exp $
package require tcltest 2
namespace import -force ::tcltest::*
testConstraint testfilehandler [llength [info commands testfilehandler]]
testConstraint testexithandler [llength [info commands testexithandler]]
testConstraint testfilewait [llength [info commands testfilewait]]
|
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
list [catch {exec [interpreter] << $script} errMsg] $errMsg
} {1 {hello
while executing
"error hello"
("after" script)}}
test event-7.6 {safe hidden bgerror fallback} {
variable result {}
interp create -safe safe
safe alias puts puts
safe alias result ::append [namespace which -variable result]
safe eval {proc bgerror m {result $m\n$::errorCode\n$::errorInfo\n}}
safe hide bgerror
safe eval after 0 error foo
update
interp delete safe
set result
} {foo
NONE
foo
while executing
"error foo"
("after" script)
}
test event-7.7 {safe hidden bgerror fallback} {
variable result {}
interp create -safe safe
safe alias puts puts
safe alias result ::append [namespace which -variable result]
safe eval {proc bgerror m {result $m\n$::errorCode\n$::errorInfo\n}}
safe hide bgerror
safe eval {proc bgerror m {error bar soom baz}}
safe eval after 0 error foo
update
interp delete safe
set result
} {foo
NONE
foo
while executing
"error foo"
("after" script)
}
# someday : add a test checking that
# when there is no bgerror, an error msg goes to stderr
# ideally one would use sub interp and transfer a fake stderr
# to it, unfortunatly the current interp tcl API does not allow
# that. the other option would be to use fork a test but it
|