summaryrefslogtreecommitdiffstats
path: root/tests/append.test
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2010-09-01 19:42:27 (GMT)
committerandreas_kupries <akupries@shaw.ca>2010-09-01 19:42:27 (GMT)
commit23a452f662f5b300b9b4f0975389f6b60c1581ad (patch)
tree30e30115955a0d384b8b161ea77c76fc062247ee /tests/append.test
parent897b68117843dfc4d00d96c98a793b3093b3ba0a (diff)
downloadtcl-23a452f662f5b300b9b4f0975389f6b60c1581ad.zip
tcl-23a452f662f5b300b9b4f0975389f6b60c1581ad.tar.gz
tcl-23a452f662f5b300b9b4f0975389f6b60c1581ad.tar.bz2
* generic/tclExecute.c: [Bug 3057639]. Applied patch by Jeff to
* generic/tclVar.c: make the behaviour of lappend in bytecompiled * tests/append.test: mode consistent with direct-eval and 'append' * tests/appendComp.test: generally. Added tests (append*-9.*) showing the difference.
Diffstat (limited to 'tests/append.test')
-rw-r--r--tests/append.test52
1 files changed, 51 insertions, 1 deletions
diff --git a/tests/append.test b/tests/append.test
index 62240cd..921b46e 100644
--- a/tests/append.test
+++ b/tests/append.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: append.test,v 1.9 2006/12/17 03:44:20 das Exp $
+# RCS: @(#) $Id: append.test,v 1.9.4.1 2010/09/01 19:42:41 andreas_kupries Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -231,6 +231,56 @@ test append-7.5 {append var does not trigger read trace} {
info exists ::result
} {0}
+# New tests for bug 3057639 to show off the more consistent behaviour
+# of lappend in both direct-eval and bytecompiled code paths (see
+# appendComp.test for the compiled variants). lappend now behaves like
+# append. 9.0/1 lappend - 9.2/3 append
+
+test append-9.0 {bug 3057639, lappend direct eval, read trace on non-existing array variable element} {
+ catch {unset myvar}
+ array set myvar {}
+ proc nonull {var key val} {
+ upvar 1 $var lvar
+ if {![info exists lvar($key)]} {
+ return -code error "no such variable"
+ }
+ }
+ trace add variable myvar read nonull
+ list [catch {
+ lappend myvar(key) "new value"
+ } msg] $msg
+} {0 {{new value}}}
+
+test append-9.1 {bug 3057639, lappend direct eval, read trace on non-existing env element} {
+ catch {unset ::env(__DUMMY__)}
+ list [catch {
+ lappend ::env(__DUMMY__) "new value"
+ } msg] $msg
+} {0 {{new value}}}
+
+test append-9.2 {bug 3057639, append direct eval, read trace on non-existing array variable element} {
+ catch {unset myvar}
+ array set myvar {}
+ proc nonull {var key val} {
+ upvar 1 $var lvar
+ if {![info exists lvar($key)]} {
+ return -code error "no such variable"
+ }
+ }
+ trace add variable myvar read nonull
+ list [catch {
+ append myvar(key) "new value"
+ } msg] $msg
+} {0 {new value}}
+
+test append-9.3 {bug 3057639, append direct eval, read trace on non-existing env element} {
+ catch {unset ::env(__DUMMY__)}
+ list [catch {
+ append ::env(__DUMMY__) "new value"
+ } msg] $msg
+} {0 {new value}}
+
+
catch {unset i x result y}
catch {rename foo ""}