diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-12-11 10:35:25 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-12-12 13:44:43 +1000 |
commit | a10d4bae942ac9e56ebc210f76f29b99dc1839e8 (patch) | |
tree | 91a509ba104167089d34638305df17f1bc17608c | |
parent | bdc3729473a79b144cbdf49fddeb288b05ccc8f5 (diff) | |
download | jimtcl-a10d4bae942ac9e56ebc210f76f29b99dc1839e8.zip jimtcl-a10d4bae942ac9e56ebc210f76f29b99dc1839e8.tar.gz jimtcl-a10d4bae942ac9e56ebc210f76f29b99dc1839e8.tar.bz2 |
Tcl8.6 compatible error messages
These will help with error messages from [apply]
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | jim.c | 6 | ||||
-rw-r--r-- | tests/proc.test | 7 |
2 files changed, 5 insertions, 8 deletions
@@ -3802,13 +3802,13 @@ static int JimCreateProcedure(Jim_Interp *interp, Jim_Obj *cmdNameObj, Jim_ListIndex(interp, argListObjPtr, i, &argPtr, JIM_NONE); len = Jim_ListLength(interp, argPtr); if (len == 0) { - Jim_SetResultString(interp, "procedure has argument with no name", -1); + Jim_SetResultString(interp, "argument with no name", -1); err: JimDecrCmdRefCount(interp, cmdPtr); return JIM_ERR; } if (len > 2) { - Jim_SetResultString(interp, "procedure has argument with too many fields", -1); + Jim_SetResultFormatted(interp, "too many fields in argument specifier \"%#s\"", argPtr); goto err; } @@ -3826,7 +3826,7 @@ err: if (Jim_CompareStringImmediate(interp, nameObjPtr, "args")) { if (cmdPtr->u.proc.argsPos >= 0) { - Jim_SetResultString(interp, "procedure has 'args' specified more than once", -1); + Jim_SetResultString(interp, "'args' specified more than once", -1); goto err; } cmdPtr->u.proc.argsPos = i; diff --git a/tests/proc.test b/tests/proc.test index 00f3ea9..50c9674 100644 --- a/tests/proc.test +++ b/tests/proc.test @@ -248,15 +248,12 @@ test proc-old-5.3 {error conditions} { -test proc-old-5.5 {error conditions} { - list [catch {proc tproc {{} y} {return foo}} msg] $msg -} {1 {procedure has argument with no name}} test proc-old-5.6 {error conditions} { list [catch {proc tproc {{} y} {return foo}} msg] $msg -} {1 {procedure has argument with no name}} +} {1 {argument with no name}} test proc-old-5.7 {error conditions} { list [catch {proc tproc {{x 1 2} y} {return foo}} msg] $msg -} {1 {procedure has argument with too many fields}} +} {1 {too many fields in argument specifier "x 1 2"}} test proc-old-5.8 {error conditions} { catch {return} } 2 |