summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-08-31 17:53:57 (GMT)
committerhobbs <hobbs>2001-08-31 17:53:57 (GMT)
commit817b9b601b9d9554766f2d5993eff50a07a733d6 (patch)
treea8425b7ecd0a7b270bdb51dfc66b53d5f7cf52c1 /tests
parent9079a1dab3c2e0624379fcbac05dc8fdb9bafde5 (diff)
downloadtcl-817b9b601b9d9554766f2d5993eff50a07a733d6.zip
tcl-817b9b601b9d9554766f2d5993eff50a07a733d6.tar.gz
tcl-817b9b601b9d9554766f2d5993eff50a07a733d6.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]
Diffstat (limited to 'tests')
-rw-r--r--tests/compile.test57
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
-
-
-
-
-
-
-
-
-
-
-
-
-