summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-10-24 09:50:09 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-10-24 09:50:09 (GMT)
commitc450611fa62e31564086453d6921a47bd7fb9044 (patch)
tree619b0222ff0ba50faefe176fa0080011972e3d07 /tests
parent0dfd8fc69d7d64b99cf8585a29cfe35133865249 (diff)
downloadtcl-c450611fa62e31564086453d6921a47bd7fb9044.zip
tcl-c450611fa62e31564086453d6921a47bd7fb9044.tar.gz
tcl-c450611fa62e31564086453d6921a47bd7fb9044.tar.bz2
Added compilation of [dict unset]; the bytecode needed already existed anyway.
Diffstat (limited to 'tests')
-rw-r--r--tests/dict.test49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/dict.test b/tests/dict.test
index aa22c00..72f239e 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -781,6 +781,55 @@ test dict-16.9 {dict unset command: write failure} -setup {
} -returnCodes error -cleanup {
unset dictVar
} -result {can't set "dictVar": variable is array}
+# Now test with an LVT present (i.e., the bytecoded version).
+test dict-16.10 {dict unset command} -body {
+ apply {{} {
+ set dictVar {a b c d}
+ dict unset dictVar a
+ }}
+} -result {c d}
+test dict-16.11 {dict unset command} -body {
+ apply {{} {
+ set dictVar {a b c d}
+ dict unset dictVar c
+ }}
+} -result {a b}
+test dict-16.12 {dict unset command} -body {
+ apply {{} {
+ set dictVar {a b}
+ dict unset dictVar c
+ }}
+} -result {a b}
+test dict-16.13 {dict unset command} -body {
+ apply {{} {
+ set dictVar {a {b c d e}}
+ dict unset dictVar a b
+ }}
+} -result {a {d e}}
+test dict-16.14 {dict unset command} -returnCodes error -body {
+ apply {{} {
+ set dictVar a
+ dict unset dictVar a
+ }}
+} -result {missing value to go with key}
+test dict-16.15 {dict unset command} -returnCodes error -body {
+ apply {{} {
+ set dictVar {a b}
+ dict unset dictVar c d
+ }}
+} -result {key "c" not known in dictionary}
+test dict-16.16 {dict unset command} -body {
+ apply {{} {list [info exists dictVar] [dict unset dictVar a] [info exists dictVar]}}
+} -result {0 {} 1}
+test dict-16.17 {dict unset command} -returnCodes error -body {
+ apply {{} {dict unset dictVar}}
+} -result {wrong # args: should be "dict unset varName key ?key ...?"}
+test dict-16.18 {dict unset command: write failure} -body {
+ apply {{} {
+ set dictVar(block) {}
+ dict unset dictVar a
+ }}
+} -returnCodes error -result {can't set "dictVar": variable is array}
test dict-17.1 {dict filter command: key} -body {
set dictVar {a1 a a2 b b1 c b2 d foo bar bar foo}