summaryrefslogtreecommitdiffstats
path: root/tests/trace.test
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2001-12-05 20:43:58 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2001-12-05 20:43:58 (GMT)
commitecb30566e2adaac0b5ee80eda58257530b1e3a7e (patch)
treee1c66b55980fda6fc20a91baffd84dd43bff7897 /tests/trace.test
parent5135eae0433e9c4fb96153356cce8f29f72c09a8 (diff)
downloadtcl-ecb30566e2adaac0b5ee80eda58257530b1e3a7e.zip
tcl-ecb30566e2adaac0b5ee80eda58257530b1e3a7e.tar.gz
tcl-ecb30566e2adaac0b5ee80eda58257530b1e3a7e.tar.bz2
new algorithm for [array get], safe when there are traces that modify the array [Bug #449893].
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