summaryrefslogtreecommitdiffstats
path: root/tests/upvar.test
diff options
context:
space:
mode:
authorsbron <tclcore@tclcode.com>2022-08-27 08:14:31 (GMT)
committersbron <tclcore@tclcode.com>2022-08-27 08:14:31 (GMT)
commit18da054782020f70383cf5764a17be7cf3b0b457 (patch)
tree87987ee973d57776488cfec08bd769eb6ee4accd /tests/upvar.test
parent8b4623feb42e145800da55276ee6987cc2f892d9 (diff)
downloadtcl-18da054782020f70383cf5764a17be7cf3b0b457.zip
tcl-18da054782020f70383cf5764a17be7cf3b0b457.tar.gz
tcl-18da054782020f70383cf5764a17be7cf3b0b457.tar.bz2
Alternative fix for the error messages by chw, which doesn't break traces on
non-existing array elements.
Diffstat (limited to 'tests/upvar.test')
-rw-r--r--tests/upvar.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/upvar.test b/tests/upvar.test
index 268bb17..3682521 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -252,6 +252,22 @@ test upvar-5.6 {unset trace on upvar array element} -body {
p1 foo bar
set x
} -result {{x1 {} unset} x1}
+test upvar-5.7 {trace on non-existent upvar array element} -body {
+ proc p1 {a b} {
+ array set foo {}
+ trace add variable foo {read write unset} tproc
+ p2
+ trace remove variable foo {read write unset} tproc
+ return [array get foo]
+ }
+ proc p2 {} {
+ upvar foo(hi) x1
+ set x1 there
+ }
+ set x ---
+ lappend x [p1 foo bar]
+ set x
+} -result {{x1 {} write} x1 {hi there}}
test upvar-6.1 {retargeting an upvar} {
proc p1 {} {