summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2014-06-03 07:26:11 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2014-06-03 07:26:11 (GMT)
commitc519b689fd1cea30413a6f1d66639d46e0850606 (patch)
tree65804b56aefa887335c7ab2fdca90059642ad5e7 /tests
parent46ab1371a7cbd2e6d244d043a47d5123a716be33 (diff)
downloadtcl-c519b689fd1cea30413a6f1d66639d46e0850606.zip
tcl-c519b689fd1cea30413a6f1d66639d46e0850606.tar.gz
tcl-c519b689fd1cea30413a6f1d66639d46e0850606.tar.bz2
[1b0266d8bb] Working towards ensuring that all dict operations are sufficiently strict.
Diffstat (limited to 'tests')
-rw-r--r--tests/dict.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/dict.test b/tests/dict.test
index a583de8..1ccad7c 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -167,6 +167,18 @@ test dict-4.8 {dict replace command} -returnCodes error -body {
} -result {missing value to go with key}
test dict-4.9 {dict replace command} {dict replace [list a a] a b} {a b}
test dict-4.10 {dict replace command} {dict replace [list a a] a b a c} {a c}
+test dict-4.11 {dict replace command: canonicality not forced} {
+ dict replace { a b c d }
+} { a b c d }
+test dict-4.12 {dict replace command: canonicality forced by update} {
+ dict replace { a b c d } a b
+} {a b c d}
+test dict-4.13 {dict replace command: type check is mandatory} -body {
+ dict replace { a b c d e }
+} -returnCodes error -result {missing value to go with key}
+test dict-4.14 {dict replace command: type check is mandatory} -body {
+ dict replace { a b {}c d }
+} -returnCodes error -result {list element in braces followed by "c" instead of space}
test dict-5.1 {dict remove command} {dict remove {a b c d} a} {c d}
test dict-5.2 {dict remove command} {dict remove {a b c d} c} {a b}
@@ -179,6 +191,21 @@ test dict-5.6 {dict remove command} {dict remove {a b} c} {a b}
test dict-5.7 {dict remove command} -returnCodes error -body {
dict remove
} -result {wrong # args: should be "dict remove dictionary ?key ...?"}
+test dict-5.8 {dict remove command: canonicality not forced} {
+ dict remove { a b c d }
+} { a b c d }
+test dict-5.9 {dict remove command: canonicality not forced} {
+ dict remove { a b c d } e
+} { a b c d }
+test dict-5.10 {dict remove command: canonicality forced by update} {
+ dict remove { a b c d } c
+} {a b}
+test dict-5.11 {dict remove command: type check is mandatory} -body {
+ dict remove { a b c d e }
+} -returnCodes error -result {missing value to go with key}
+test dict-5.12 {dict remove command: type check is mandatory} -body {
+ dict remove { a b {}c d }
+} -returnCodes error -result {list element in braces followed by "c" instead of space}
test dict-6.1 {dict keys command} {dict keys {a b}} a
test dict-6.2 {dict keys command} {dict keys {c d}} c
@@ -1226,6 +1253,21 @@ test dict-20.19 {dict merge command} {
test dict-20.20 {dict merge command} {
apply {{} {dict merge {a b c d e f} {a x 1 2 3 4} {a - 1 -}}}
} {a - c d e f 1 - 3 4}
+test dict-20.21 {dict merge command: canonicality not forced} {
+ dict merge { a b c d }
+} { a b c d }
+test dict-20.22 {dict merge command: canonicality not forced} {
+ dict merge { a b c d } {}
+} { a b c d }
+test dict-20.23 {dict merge command: canonicality forced by update} {
+ dict merge { a b c d } {a b}
+} {a b c d}
+test dict-20.24 {dict merge command: type check is mandatory} -body {
+ dict merge { a b c d e }
+} -returnCodes error -result {missing value to go with key}
+test dict-20.25 {dict merge command: type check is mandatory} -body {
+ dict merge { a b {}c d }
+} -returnCodes error -result {list element in braces followed by "c" instead of space}
test dict-21.1 {dict update command} -returnCodes 1 -body {
dict update