diff options
author | Steve Bennett <steveb@workware.net.au> | 2014-01-12 20:38:03 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2014-01-15 11:23:44 +1000 |
commit | 93ea2fcea92f79350067d684b29e520eff8eabe8 (patch) | |
tree | a6a81f14530611ffec5f0383785bcac454da3ed7 | |
parent | fe933ad8fdc1069d54fd97a961ef698109c600ae (diff) | |
download | jimtcl-93ea2fcea92f79350067d684b29e520eff8eabe8.zip jimtcl-93ea2fcea92f79350067d684b29e520eff8eabe8.tar.gz jimtcl-93ea2fcea92f79350067d684b29e520eff8eabe8.tar.bz2 |
array: array set to non-dict should fail
Currently returns the error message but does not set JIM_ERR
Also add a test case
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | jim-array.c | 3 | ||||
-rw-r--r-- | tests/dict2.test | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/jim-array.c b/jim-array.c index 3bb74c6..bf07e07 100644 --- a/jim-array.c +++ b/jim-array.c @@ -174,6 +174,9 @@ static int array_cmd_set(Jim_Interp *interp, int argc, Jim_Obj *const *argv) /* Doesn't exist, so just set the list directly */ return Jim_SetVariable(interp, argv[0], listObj); } + else if (Jim_DictSize(interp, dictObj) < 0) { + return JIM_ERR; + } if (Jim_IsShared(dictObj)) { dictObj = Jim_DuplicateObj(interp, dictObj); diff --git a/tests/dict2.test b/tests/dict2.test index 01826dc..2e9bcd4 100644 --- a/tests/dict2.test +++ b/tests/dict2.test @@ -120,6 +120,10 @@ test dict-3.15 {compiled dict get error cleanliness - Bug 2431847} -body { } -returnCodes error -result {key "d" not known in dictionary} test dict-3.16 {dict/list shimmering - Bug 3004007} {set l [list p 1 p 2 q 3];dict get $l q;set l} {p 1 p 2 q 3} test dict-3.17 {dict/list shimmering - Bug 3004007} {set l [list p 1 p 2 q 3];dict get $l q;llength $l} 6 +test dict-3.18 {array set non-dict get command} -constraints jim -returnCodes error -body { + set a one + array set a {a b c d} +} -result {missing value to go with key} test dict-4.1 {dict replace command} { dict replace {a b c d} |