diff options
author | hobbs <hobbs@noemail.net> | 2001-08-31 17:53:56 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2001-08-31 17:53:56 (GMT) |
commit | b63d2a8bf9e5739d7f7788b3e0ceeaa92bfd5590 (patch) | |
tree | a8425b7ecd0a7b270bdb51dfc66b53d5f7cf52c1 /tests/compile.test | |
parent | 56391068f0faa703d41de7a312e719cd578b0ca2 (diff) | |
download | tcl-b63d2a8bf9e5739d7f7788b3e0ceeaa92bfd5590.zip tcl-b63d2a8bf9e5739d7f7788b3e0ceeaa92bfd5590.tar.gz tcl-b63d2a8bf9e5739d7f7788b3e0ceeaa92bfd5590.tar.bz2 |
* tests/compile.test: added compile-11.* interp result checks
* generic/tclUtil.c (TclGetIntForIndex): added Tcl_ResetResult
before Tcl_AppendStringsToObj to prevent shared object crash when
called from bcc instruction. The Tcl_Append* calls that append to
the result object that are invoked by bcc insts must remember to
call Tcl_ResetResult because the bcc doesn't do this for us.
[Bug #456892]
FossilOrigin-Name: 6a841ea6f8d77bfba423cf5ed956975cc63ea673
Diffstat (limited to 'tests/compile.test')
-rw-r--r-- | tests/compile.test | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/tests/compile.test b/tests/compile.test index 2a8d6b8..5e81a5c 100644 --- a/tests/compile.test +++ b/tests/compile.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: compile.test,v 1.10 2001/08/22 13:57:53 msofer Exp $ +# RCS: @(#) $Id: compile.test,v 1.11 2001/08/31 17:53:57 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -197,7 +197,47 @@ test compile-10.1 {BLACKBOX: exception stack overflow} { } } {} - +test compile-11.1 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { + # shared object - Interp result && Var 'r' + set r [list foobar] + # command that will add error to result + lindex a bogus + } + list [catch {p} msg] $msg +} {1 {bad index "bogus": must be integer or end?-integer?}} +test compile-11.2 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; string index a bogus } + list [catch {p} msg] $msg +} {1 {bad index "bogus": must be integer or end?-integer?}} +test compile-11.3 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; string index a 09 } + list [catch {p} msg] $msg +} {1 {bad index "09": must be integer or end?-integer? (looks like invalid octal number)}} +test compile-11.4 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; array set var {one two many} } + list [catch {p} msg] $msg +} {1 {list must have an even number of elements}} +test compile-11.5 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; incr foo } + list [catch {p} msg] $msg +} {1 {can't read "foo": no such variable}} +test compile-11.6 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; incr foo bogus } + list [catch {p} msg] $msg +} {1 {expected integer but got "bogus"}} +test compile-11.7 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; expr !a } + list [catch {p} msg] $msg +} {1 {syntax error in expression "!a"}} +test compile-11.8 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; expr {!a} } + list [catch {p} msg] $msg +} {1 {syntax error in expression "!a"}} +test compile-11.9 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { + proc p {} { set r [list foobar] ; llength "\{" } + list [catch {p} msg] $msg +} {1 {unmatched open brace in list}} # cleanup catch {rename p ""} @@ -207,16 +247,3 @@ catch {unset y} catch {unset a} ::tcltest::cleanupTests return - - - - - - - - - - - - - |