summaryrefslogtreecommitdiffstats
path: root/tests/dict.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2019-04-18 22:57:12 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2019-04-18 22:57:12 (GMT)
commit8b9a3558a42cba96fe30f272517260aef43ec7f8 (patch)
tree746ed45f250192ce777a12d31690f1b0847a5474 /tests/dict.test
parent9cf9c0a5e5c1bc1e2cf81abce0c91a9acd632977 (diff)
downloadtcl-8b9a3558a42cba96fe30f272517260aef43ec7f8.zip
tcl-8b9a3558a42cba96fe30f272517260aef43ec7f8.tar.gz
tcl-8b9a3558a42cba96fe30f272517260aef43ec7f8.tar.bz2
Compilation for [dict getwithdefault].
Diffstat (limited to 'tests/dict.test')
-rw-r--r--tests/dict.test49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/dict.test b/tests/dict.test
index 6d74b96..62590e7 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -2048,6 +2048,7 @@ test dict-25.1 {compiled dict update with low-refcount values [Bug d553228d9f]}
}}
} {}
+set dict dict; # Used to force interpretation, not compilation
test dict-26.1 {dict getdef command} -body {
dict getdef {a b} a c
} -result b
@@ -2075,6 +2076,30 @@ test dict-26.8 {dict getdef command} -returnCodes error -body {
test dict-26.9 {dict getdef command} -returnCodes error -body {
dict getdef {} {}
} -result {wrong # args: should be "dict getdef dictionary ?key ...? key default"}
+test dict-26.10 {dict getdef command} -returnCodes error -body {
+ dict getdef {a b c} d e
+} -result {missing value to go with key}
+test dict-26.11 {dict getdef command} -body {
+ $dict getdef {a b} a c
+} -result b
+test dict-26.12 {dict getdef command} -body {
+ $dict getdef {a b} b c
+} -result c
+test dict-26.13 {dict getdef command} -body {
+ $dict getdef {a {b c}} a b d
+} -result c
+test dict-26.14 {dict getdef command} -body {
+ $dict getdef {a {b c}} a c d
+} -result d
+test dict-26.15 {dict getdef command} -body {
+ $dict getdef {a {b c}} b c d
+} -result d
+test dict-26.16 {dict getdef command} -returnCodes error -body {
+ $dict getdef {a {b c d}} a b d
+} -result {missing value to go with key}
+test dict-26.17 {dict getdef command} -returnCodes error -body {
+ $dict getdef {a b c} d e
+} -result {missing value to go with key}
test dict-27.1 {dict getwithdefault command} -body {
dict getwithdefault {a b} a c
@@ -2103,6 +2128,30 @@ test dict-27.8 {dict getwithdefault command} -returnCodes error -body {
test dict-27.9 {dict getwithdefault command} -returnCodes error -body {
dict getwithdefault {} {}
} -result {wrong # args: should be "dict getwithdefault dictionary ?key ...? key default"}
+test dict-26.10 {dict getdef command} -returnCodes error -body {
+ dict getwithdefault {a b c} d e
+} -result {missing value to go with key}
+test dict-27.11 {dict getwithdefault command} -body {
+ $dict getwithdefault {a b} a c
+} -result b
+test dict-27.12 {dict getwithdefault command} -body {
+ $dict getwithdefault {a b} b c
+} -result c
+test dict-27.13 {dict getwithdefault command} -body {
+ $dict getwithdefault {a {b c}} a b d
+} -result c
+test dict-27.14 {dict getwithdefault command} -body {
+ $dict getwithdefault {a {b c}} a c d
+} -result d
+test dict-27.15 {dict getwithdefault command} -body {
+ $dict getwithdefault {a {b c}} b c d
+} -result d
+test dict-27.16 {dict getwithdefault command} -returnCodes error -body {
+ $dict getwithdefault {a {b c d}} a b d
+} -result {missing value to go with key}
+test dict-26.17 {dict getdef command} -returnCodes error -body {
+ $dict getwithdefault {a b c} d e
+} -result {missing value to go with key}
# cleanup
::tcltest::cleanupTests