diff options
Diffstat (limited to 'tests/errors.tcl')
-rw-r--r-- | tests/errors.tcl | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/errors.tcl b/tests/errors.tcl index 7f5cdc8..1105dfa 100644 --- a/tests/errors.tcl +++ b/tests/errors.tcl @@ -1,58 +1,59 @@ # Package which can generate a variety of errors at known locations proc error_generator {type} { - switch $type \ + switch $type { badcmd { bogus command called - } \ + } badvar { set bogus - } \ + } error { error bogus - } \ + } interpbadvar { set x "some $bogus text" - } \ + } interpbadcmd { set x "some $bogus text" - } \ + } package { package require dummy - } \ + } source { source dummy.tcl - } \ + } badpackage { package require bogus - } \ + } returncode { return -code error failure - } \ + } default { puts "Unknown type=$type" } + } } - # line 40: Some empty lines above so that line numbers don't change proc error_caller {type {method call}} { - switch $method \ + switch $method { call { error_generator $type - } \ + } uplevel { uplevel 1 [list error_generator $type] - } \ + } eval { eval [list error_generator $type] - } \ + } evalstr { eval error_generator $type - } \ + } default { puts "Unknown method=$method" } + } } |