summaryrefslogtreecommitdiffstats
path: root/tests/trace.test
diff options
context:
space:
mode:
authormsofer <msofer@noemail.net>2001-12-05 20:43:57 (GMT)
committermsofer <msofer@noemail.net>2001-12-05 20:43:57 (GMT)
commitc9d9579934530b19dc66427645bfaec0ecb9cf84 (patch)
treee1c66b55980fda6fc20a91baffd84dd43bff7897 /tests/trace.test
parent16a2e8645619f27282179ba2773b105cf225a1b1 (diff)
downloadtcl-c9d9579934530b19dc66427645bfaec0ecb9cf84.zip
tcl-c9d9579934530b19dc66427645bfaec0ecb9cf84.tar.gz
tcl-c9d9579934530b19dc66427645bfaec0ecb9cf84.tar.bz2
new algorithm for [array get], safe when there are traces that modify the array [Bug #449893].
FossilOrigin-Name: 986407077b57825037784c7c9612b42619c46eec
Diffstat (limited to 'tests/trace.test')
-rw-r--r--tests/trace.test30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/trace.test b/tests/trace.test
index b82b399..beab9c6 100644
--- a/tests/trace.test
+++ b/tests/trace.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: trace.test,v 1.14 2001/11/21 19:53:40 dgp Exp $
+# RCS: @(#) $Id: trace.test,v 1.15 2001/12/05 20:43:58 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -140,6 +140,34 @@ test trace-1.10 {trace variable reads} {
unset x
set info
} {}
+test trace-1.11 {read traces that modify the array structure} {
+ catch {unset x}
+ set x(bar) 0
+ trace variable x r {set x(foo) 1 ;#}
+ trace variable x r {unset -nocomplain x(bar) ;#}
+ array get x
+} {}
+test trace-1.12 {read traces that modify the array structure} {
+ catch {unset x}
+ set x(bar) 0
+ trace variable x r {unset -nocomplain x(bar) ;#}
+ trace variable x r {set x(foo) 1 ;#}
+ array get x
+} {}
+test trace-1.13 {read traces that modify the array structure} {
+ catch {unset x}
+ set x(bar) 0
+ trace variable x r {set x(foo) 1 ;#}
+ trace variable x r {unset -nocomplain x;#}
+ list [catch {array get x} res] $res
+} {1 {can't read "x(bar)": no such variable}}
+test trace-1.14 {read traces that modify the array structure} {
+ catch {unset x}
+ set x(bar) 0
+ trace variable x r {unset -nocomplain x;#}
+ trace variable x r {set x(foo) 1 ;#}
+ list [catch {array get x} res] $res
+} {1 {can't read "x(bar)": no such variable}}
# Basic write-tracing on variables