summaryrefslogtreecommitdiffstats
path: root/tests/dict.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-10-05 14:19:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-10-05 14:19:47 (GMT)
commit58307e4ecd7de78e0ef00884da41cfec0a2a4f2f (patch)
tree6ee38112a19c42136dcd9bafdc9c72f038d0bd87 /tests/dict.test
parent0c1dfce40a837faf1c36b892439f57f1fc49d356 (diff)
downloadtcl-58307e4ecd7de78e0ef00884da41cfec0a2a4f2f.zip
tcl-58307e4ecd7de78e0ef00884da41cfec0a2a4f2f.tar.gz
tcl-58307e4ecd7de78e0ef00884da41cfec0a2a4f2f.tar.bz2
Added some tests.
Diffstat (limited to 'tests/dict.test')
-rw-r--r--tests/dict.test66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/dict.test b/tests/dict.test
index d80a11f..41c21e2 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -1358,6 +1358,72 @@ test dict-22.11 {dict with command: no recursive structures [Bug 1786481]} -body
} -cleanup {
unset foo t inner
} -result OK
+test dict-22.12 {dict with: compiled} {
+ apply {{} {
+ set d {a 1 b 2}
+ list [dict with d {
+ set a $b
+ unset b
+ dict set d c 3
+ list ok
+ }] $d
+ }}
+} {ok {a 2 c 3}}
+test dict-22.13 {dict with: compiled} {
+ apply {i {
+ set d($i) {a 1 b 2}
+ list [dict with d($i) {
+ set a $b
+ unset b
+ dict set d($i) c 3
+ list ok
+ }] [array get d]
+ }} e
+} {ok {e {a 2 c 3}}}
+test dict-22.14 {dict with: compiled} {
+ apply {{} {
+ set d {a 1 b 2}
+ foreach x {1 2 3} {
+ dict with d {
+ incr a $b
+ if {$x == 2} break
+ }
+ unset a b
+ }
+ list $a $b $x $d
+ }}
+} {5 2 2 {a 5 b 2}}
+test dict-22.15 {dict with: compiled} {
+ apply {i {
+ set d($i) {a 1 b 2}
+ foreach x {1 2 3} {
+ dict with d($i) {
+ incr a $b
+ if {$x == 2} break
+ }
+ unset a b
+ }
+ list $a $b $x [array get d]
+ }} e
+} {5 2 2 {e {a 5 b 2}}}
+test dict-22.16 {dict with: compiled} {
+ apply {{} {
+ set d {p {q {a 1 b 2}}}
+ dict with d p q {
+ set a $b.$a
+ }
+ return $d
+ }}
+} {p {q {a 2.1 b 2}}}
+test dict-22.17 {dict with: compiled} {
+ apply {i {
+ set d($i) {p {q {a 1 b 2}}}
+ dict with d($i) p q {
+ set a $b.$a
+ }
+ array get d
+ }} e
+} {e {p {q {a 2.1 b 2}}}}
# cleanup
::tcltest::cleanupTests