aboutsummaryrefslogtreecommitdiff
path: root/tests/dict.test
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2014-01-18 13:27:23 +1000
committerSteve Bennett <steveb@workware.net.au>2014-01-18 13:28:01 +1000
commit5e56e1547ceaa2ce77beac0317f72b9ebc945d0e (patch)
tree455bcc750463c2c5a39eb553e7f402ee41e9e11b /tests/dict.test
parente04991828210b4fee8cb84a334d28c242bd5e274 (diff)
downloadjimtcl-5e56e1547ceaa2ce77beac0317f72b9ebc945d0e.zip
jimtcl-5e56e1547ceaa2ce77beac0317f72b9ebc945d0e.tar.gz
jimtcl-5e56e1547ceaa2ce77beac0317f72b9ebc945d0e.tar.bz2
jim.c: fix some dict/list shimmering issues
Only do fast dict->list conversion if there is no string rep When converting list->dict, generate the string rep of a shared list to avoid loss of info when converting to dict. Also add a relevent test to dict.test Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/dict.test')
-rw-r--r--tests/dict.test11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/dict.test b/tests/dict.test
index 6387cd0..c0528e8 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -237,5 +237,16 @@ test dict-24.3 {dict/list shimmering with embedded nulls} {
lassign $dictVar k v
string length $v
} {3}
+test dict-24.4 {dict/list shimmering with lappend and foreach} {
+ set a [list 1 2 3 4]
+
+ foreach b $a {
+ # convert to dict
+ dict size $a
+ # append to list
+ lappend a x y
+ }
+ llength $a
+} 12
testreport