summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/upvar.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/upvar.test b/tests/upvar.test
index c31eaa1..268bb17 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -207,6 +207,51 @@ test upvar-5.3 {traces involving upvars} {
p1 foo bar
set x
} {{x1 {} u} x1}
+test upvar-5.4 {read trace on upvar array element} -body {
+ proc p1 {a b} {
+ array set foo {c 22 d 33}
+ trace add variable foo {read write unset} tproc
+ p2
+ trace remove variable foo {read write unset} tproc
+ }
+ proc p2 {} {
+ upvar foo(c) x1
+ set x1
+ }
+ set x ---
+ p1 foo bar
+ set x
+} -result {{x1 {} read} x1}
+test upvar-5.5 {write trace on upvar array element} -body {
+ proc p1 {a b} {
+ array set foo {c 22 d 33}
+ trace add variable foo {read write unset} tproc
+ p2
+ trace remove variable foo {read write unset} tproc
+ }
+ proc p2 {} {
+ upvar foo(c) x1
+ set x1 22
+ }
+ set x ---
+ p1 foo bar
+ set x
+} -result {{x1 {} write} x1}
+test upvar-5.6 {unset trace on upvar array element} -body {
+ proc p1 {a b} {
+ array set foo {c 22 d 33}
+ trace add variable foo {read write unset} tproc
+ p2
+ trace remove variable foo {read write unset} tproc
+ }
+ proc p2 {} {
+ upvar foo(c) x1
+ unset x1
+ }
+ set x ---
+ p1 foo bar
+ set x
+} -result {{x1 {} unset} x1}
test upvar-6.1 {retargeting an upvar} {
proc p1 {} {