diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-12-12 10:42:18 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-12-12 13:44:43 +1000 |
commit | d377de0daf8c8e257b85594242ad094420f12cdc (patch) | |
tree | fa84309829cc2a3f4c38189cb8e70c2a1a053b73 | |
parent | 7cff4d617b4d89c73a49d5b57f851c2a74145b03 (diff) | |
download | jimtcl-d377de0daf8c8e257b85594242ad094420f12cdc.zip jimtcl-d377de0daf8c8e257b85594242ad094420f12cdc.tar.gz jimtcl-d377de0daf8c8e257b85594242ad094420f12cdc.tar.bz2 |
Strip leading & from proc error messages
And some more Tcl8.6 compatible error messages
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | jim.c | 11 | ||||
-rw-r--r-- | tests/dict.test | 4 | ||||
-rw-r--r-- | tests/procref.test | 12 | ||||
-rw-r--r-- | tests/tree.test | 2 |
4 files changed, 16 insertions, 13 deletions
@@ -6732,8 +6732,7 @@ static int SetDictFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) /* For simplicity, convert a non-list object to a list and then to a dict */ listlen = Jim_ListLength(interp, objPtr); if (listlen % 2) { - Jim_SetResultString(interp, - "invalid dictionary value: must be a list with an even number of elements", -1); + Jim_SetResultString(interp, "missing value to go with key", -1); return JIM_ERR; } else { @@ -6846,7 +6845,7 @@ int Jim_DictKey(Jim_Interp *interp, Jim_Obj *dictPtr, Jim_Obj *keyPtr, ht = dictPtr->internalRep.ptr; if ((he = Jim_FindHashEntry(ht, keyPtr)) == NULL) { if (flags & JIM_ERRMSG) { - Jim_SetResultFormatted(interp, "key \"%#s\" not found in dictionary", keyPtr); + Jim_SetResultFormatted(interp, "key \"%#s\" not known in dictionary", keyPtr); } return JIM_ERR; } @@ -10420,7 +10419,11 @@ static void JimSetProcWrongArgs(Jim_Interp *interp, Jim_Obj *procNameObj, Jim_Cm Jim_AppendString(interp, argmsg, "?", 1); } else { - Jim_AppendObj(interp, argmsg, cmd->u.proc.arglist[i].nameObjPtr); + const char *arg = Jim_String(cmd->u.proc.arglist[i].nameObjPtr); + if (*arg == '&') { + arg++; + } + Jim_AppendString(interp, argmsg, arg, -1); } } } diff --git a/tests/dict.test b/tests/dict.test index 3a0218b..1b3f5a5 100644 --- a/tests/dict.test +++ b/tests/dict.test @@ -208,7 +208,7 @@ test dict-23.2 {dict unset command} -returnCodes error -body { dict unset dictVar a } -cleanup { unset dictVar -} -result {invalid dictionary value: must be a list with an even number of elements} +} -result {missing value to go with key} test dict-23.3 {dict unset command} -setup { unset -nocomplain dictVar @@ -225,6 +225,6 @@ test dict-23.4 {dict unset command: write failure} -setup { dict unset dictVar a } -returnCodes error -cleanup { unset dictVar -} -result {invalid dictionary value: must be a list with an even number of elements} +} -result {missing value to go with key} testreport diff --git a/tests/procref.test b/tests/procref.test index 63206d5..a9fdf41 100644 --- a/tests/procref.test +++ b/tests/procref.test @@ -36,18 +36,18 @@ test procref-1.2 {Basic test} { set B } {1bb} -test procref-1.3 {Unset var} { - catch {a1 unsetB $C} -} 1 +test procref-1.3 {Unset var} -body { + a1 unsetB $C +} -returnCodes error -result {can't read "unsetB": no such variable} test procref-1.4 {Left and right args are refs} { a2 B C list $B $C } {1bbb 1c} -test procref-1.5 {Invalid arg} { - catch {a3 B} -} 1 +test procref-1.5 {Invalid arg} -body { + a3 B +} -returnCodes error -result {bad variable name "b(c)": upvar won't create a scalar variable that looks like an array element} test procref-1.6 {Default arg as ref} { a4 diff --git a/tests/tree.test b/tests/tree.test index 30171bc..5a7cf74 100644 --- a/tests/tree.test +++ b/tests/tree.test @@ -19,7 +19,7 @@ test tree-1.3 "Access invalid node" { list [catch { $pt depth bogus } msg] $msg -} {1 {key "bogus" not found in dictionary}} +} {1 {key "bogus" not known in dictionary}} test tree-1.4 "Set key/value" { $pt set root key value |