summaryrefslogtreecommitdiffstats
path: root/tests/foreach.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-03-12 20:45:26 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-03-12 20:45:26 (GMT)
commita515e66f386d98551f2ec1185ab2d6a925b03b5f (patch)
tree4b7cb67b16150414d6d59dc83ba0e72bcb4f525b /tests/foreach.test
parenteff94c7a58c193ba8ea8e4b527d89bd7f9a404aa (diff)
downloadtcl-a515e66f386d98551f2ec1185ab2d6a925b03b5f.zip
tcl-a515e66f386d98551f2ec1185ab2d6a925b03b5f.tar.gz
tcl-a515e66f386d98551f2ec1185ab2d6a925b03b5f.tar.bz2
* generic/tclExecute.c (INST_FOREACH_STEP4): Make private copy
* tests/foreach.test (foreach-10.1): of value list to be assigned to variables so that shimmering of that list doesn't lead to invalid pointers. [Bug 1671087]
Diffstat (limited to 'tests/foreach.test')
-rw-r--r--tests/foreach.test14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/foreach.test b/tests/foreach.test
index a49ceaa..8fb5144 100644
--- a/tests/foreach.test
+++ b/tests/foreach.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: foreach.test,v 1.12 2007/03/01 17:55:16 dgp Exp $
+# RCS: @(#) $Id: foreach.test,v 1.13 2007/03/12 20:45:27 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -256,6 +256,18 @@ test foreach-9.1 {compiled empty var list} {
list [catch { foo } msg] $msg
} {1 {foreach varlist is empty}}
+test foreach-10.1 {foreach: [Bug 1671087]} -setup {
+ proc demo {} {
+ set vals {1 2 3 4}
+ trace add variable x write {string length $vals ;# }
+ foreach {x y} $vals {format $y}
+ }
+} -body {
+ demo
+} -cleanup {
+ rename demo {}
+} -result {}
+
# cleanup
catch {unset a}
catch {unset x}