summaryrefslogtreecommitdiffstats
path: root/tests/dict.test
diff options
context:
space:
mode:
authorhypnotoad <hypnotoad@noemail.net>2012-12-31 20:39:31 (GMT)
committerhypnotoad <hypnotoad@noemail.net>2012-12-31 20:39:31 (GMT)
commita9ecc9e4e2dfa277eef680b8f60c42a648ad9826 (patch)
tree3e85593090a7835405ac2cdf02b27727936244d4 /tests/dict.test
parentdb8b97d360aa37dcc471e1ba86af95a578f25f63 (diff)
downloadtcl-bug-3598385.zip
tcl-bug-3598385.tar.gz
tcl-bug-3598385.tar.bz2
Bug fix for 3598385bug-3598385
dict exists now throws an error if an invalid dict is encountered, according to the same rules as exists prior to January 2012 (Checkin [22ec97b057]) This patch includes fixes for both the bytecode compiled version of dict exists, the non-bytecode version of dict exists, and updates as well as several new cases for the dict regression tests The patch for dict.test checks both the compiled and non-compiled versions of the dict exists command FossilOrigin-Name: e04297dbf76f69e8559898cd2778109c710d4133
Diffstat (limited to 'tests/dict.test')
-rw-r--r--tests/dict.test44
1 files changed, 36 insertions, 8 deletions
diff --git a/tests/dict.test b/tests/dict.test
index 72a336c..2b771f8 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -227,18 +227,46 @@ test dict-8.6 {dict size command} -returnCodes error -body {
dict size a
} -result {missing value to go with key}
-test dict-9.1 {dict exists command} {dict exists {a b} a} 1
-test dict-9.2 {dict exists command} {dict exists {a b} b} 0
-test dict-9.3 {dict exists command} {dict exists {a {b c}} a b} 1
-test dict-9.4 {dict exists command} {dict exists {a {b c}} a c} 0
-test dict-9.5 {dict exists command} {dict exists {a {b c}} b c} 0
-test dict-9.6 {dict exists command} {dict exists {a {b c d}} a c} 0
-test dict-9.7 {dict exists command} -returnCodes error -body {
+test dict-9.1 {dict exists command} {dict exists {a b} a} 1
+test dict-9.2 {dict exists command} {dict exists {a b} b} 0
+test dict-9.3 {dict exists command} {dict exists {a {b c}} a b} 1
+test dict-9.4 {dict exists command} {dict exists {a {b c}} a c} 0
+test dict-9.5 {dict exists command} {dict exists {a {b c}} b c} 0
+test dict-9.6 {dict exists command} -returnCodes error -body {
+ dict exists {a {b c d}} a c
+} -result {missing value to go with key}
+test dict-9.7 {dict exists command} -returnCodes error -body {
dict exists
} -result {wrong # args: should be "dict exists dictionary key ?key ...?"}
-test dict-9.8 {dict exists command} -returnCodes error -body {
+test dict-9.8 {dict exists command} -returnCodes error -body {
dict exists {}
} -result {wrong # args: should be "dict exists dictionary key ?key ...?"}
+test dict-9.9 {dict exists command} {dict exists {} any} 0
+test dict-9.10 {dict exists command} -returnCodes error -body {
+ dict exists any any
+} -result {missing value to go with key}
+
+# Repeat for non-bytecode compiled implementation
+set cmd dict
+test dict-9.1n {dict exists command (non-compiled)} {$cmd exists {a b} a} 1
+test dict-9.2n {dict exists command (non-compiled)} {$cmd exists {a b} b} 0
+test dict-9.3n {dict exists command (non-compiled)} {$cmd exists {a {b c}} a b} 1
+test dict-9.4n {dict exists command (non-compiled)} {$cmd exists {a {b c}} a c} 0
+test dict-9.5n {dict exists command (non-compiled)} {$cmd exists {a {b c}} b c} 0
+test dict-9.6n {dict exists command (non-compiled)} -returnCodes error -body {
+ $cmd exists {a {b c d}} a c
+} -result {missing value to go with key}
+test dict-9.7n {dict exists command (non-compiled)} -returnCodes error -body {
+ $cmd exists
+} -result {wrong # args: should be "dict exists dictionary key ?key ...?"}
+test dict-9.8n {dict exists command (non-compiled)} -returnCodes error -body {
+ $cmd exists {}
+} -result {wrong # args: should be "dict exists dictionary key ?key ...?"}
+test dict-9.9n {dict exists command (non-compiled)} {$cmd exists {} any} 0
+test dict-9.10n {dict exists command (non-compiled)} -returnCodes error -body {
+ $cmd exists any any
+} -result {missing value to go with key}
+
test dict-10.1 {dict info command} -body {
# Actual string returned by this command is undefined; it is