summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-03-10 17:54:46 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-03-10 17:54:46 (GMT)
commit329fba90403d605eace298e0ed1cbf251c85d65a (patch)
tree4f3a29687c3684bd2a07dfc4d8924bd0b50cec8f /tests
parent59ee2f1e347fb19a9228787a2fc637dbff1d875c (diff)
downloadtcl-329fba90403d605eace298e0ed1cbf251c85d65a.zip
tcl-329fba90403d605eace298e0ed1cbf251c85d65a.tar.gz
tcl-329fba90403d605eace298e0ed1cbf251c85d65a.tar.bz2
* generic/tclEvent.c (TclDefaultBgErrorHandlerObjCmd): Added error
* tests/event.test (event-5.*): checking to protect against callers passing invalid return options dictionaries. [Bug 1901113]
Diffstat (limited to 'tests')
-rw-r--r--tests/event.test65
1 files changed, 64 insertions, 1 deletions
diff --git a/tests/event.test b/tests/event.test
index 5492140..bdfad16 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -9,7 +9,7 @@
# 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.26 2007/12/13 15:26:06 dgp Exp $
+# RCS: @(#) $Id: event.test,v 1.27 2008/03/10 17:54:47 dgp Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -205,6 +205,69 @@ test event-5.3 {HandleBgErrors: [Bug 1670155]} -setup {
rename demo {}
rename trial {}
} -result {}
+test event-5.3 {Default [interp bgerror] handler} -body {
+ ::tcl::Bgerror
+} -returnCodes error -match glob -result {*msg options*}
+test event-5.4 {Default [interp bgerror] handler} -body {
+ ::tcl::Bgerror {}
+} -returnCodes error -match glob -result {*msg options*}
+test event-5.5 {Default [interp bgerror] handler} -body {
+ ::tcl::Bgerror {} {} {}
+} -returnCodes error -match glob -result {*msg options*}
+test event-5.6 {Default [interp bgerror] handler} -body {
+ ::tcl::Bgerror {} {}
+} -returnCodes error -match glob -result {*-level*}
+test event-5.7 {Default [interp bgerror] handler} -body {
+ ::tcl::Bgerror {} {-level foo}
+} -returnCodes error -match glob -result {*expected integer*}
+test event-5.8 {Default [interp bgerror] handler} -body {
+ ::tcl::Bgerror {} {-level 0}
+} -returnCodes error -match glob -result {*-code*}
+test event-5.9 {Default [interp bgerror] handler} -body {
+ ::tcl::Bgerror {} {-level 0 -code ok}
+} -returnCodes error -match glob -result {*expected integer*}
+test event-5.10 {Default [interp bgerror] handler} {
+ proc bgerror {m} {append ::res $m}
+ set ::res {}
+ ::tcl::Bgerror {} {-level 0 -code 0}
+ rename bgerror {}
+ set ::res
+} {}
+test event-5.11 {Default [interp bgerror] handler} {
+ proc bgerror {m} {append ::res $m}
+ set ::res {}
+ ::tcl::Bgerror msg {-level 0 -code 1}
+ rename bgerror {}
+ set ::res
+} {msg}
+test event-5.12 {Default [interp bgerror] handler} {
+ proc bgerror {m} {append ::res $m}
+ set ::res {}
+ ::tcl::Bgerror msg {-level 0 -code 2}
+ rename bgerror {}
+ set ::res
+} {command returned bad code: 2}
+test event-5.13 {Default [interp bgerror] handler} {
+ proc bgerror {m} {append ::res $m}
+ set ::res {}
+ ::tcl::Bgerror msg {-level 0 -code 3}
+ rename bgerror {}
+ set ::res
+} {invoked "break" outside of a loop}
+test event-5.14 {Default [interp bgerror] handler} {
+ proc bgerror {m} {append ::res $m}
+ set ::res {}
+ ::tcl::Bgerror msg {-level 0 -code 4}
+ rename bgerror {}
+ set ::res
+} {invoked "continue" outside of a loop}
+test event-5.15 {Default [interp bgerror] handler} {
+ proc bgerror {m} {append ::res $m}
+ set ::res {}
+ ::tcl::Bgerror msg {-level 0 -code 5}
+ rename bgerror {}
+ set ::res
+} {command returned bad code: 5}
test event-6.1 {BgErrorDeleteProc procedure} {
catch {interp delete foo}