diff options
author | sebres <sebres@users.sourceforge.net> | 2017-05-10 12:29:59 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-05-10 12:29:59 (GMT) |
commit | b0cef09790ace51d01d8e0aa6ad9bea27c745cb4 (patch) | |
tree | 1e7ceaadb60c8e22afab0cfcc916f72e15ff8280 | |
parent | efee121d8db22043e295d65a80ec3486ee0ac6fb (diff) | |
download | tcl-b0cef09790ace51d01d8e0aa6ad9bea27c745cb4.zip tcl-b0cef09790ace51d01d8e0aa6ad9bea27c745cb4.tar.gz tcl-b0cef09790ace51d01d8e0aa6ad9bea27c745cb4.tar.bz2 |
Fixed wrong args message (e.g. "clock format ..." instead of "::tcl::clock::format") if failed through compiled ensemble execution.
-rw-r--r-- | generic/tclClock.c | 14 | ||||
-rw-r--r-- | tests/clock.test | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index ad3d6e7..a066f73 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2865,7 +2865,7 @@ ClockClicksObjCmd( } break; default: - Tcl_WrongNumArgs(interp, 1, objv, "?-switch?"); + Tcl_WrongNumArgs(interp, 0, NULL, "clock clicks ?-switch?"); return TCL_ERROR; } @@ -2918,7 +2918,7 @@ ClockMillisecondsObjCmd( Tcl_Time now; if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock milliseconds"); return TCL_ERROR; } Tcl_GetTime(&now); @@ -2953,7 +2953,7 @@ ClockMicrosecondsObjCmd( Tcl_Obj *const *objv) /* Parameter values */ { if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock microseconds"); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclpGetMicroseconds())); @@ -3223,7 +3223,7 @@ ClockFormatObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now " + Tcl_WrongNumArgs(interp, 0, NULL, "clock format clockval|-now " "?-format string? " "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); @@ -3298,7 +3298,7 @@ ClockScanObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "string " + Tcl_WrongNumArgs(interp, 0, NULL, "clock scan string " "?-base seconds? " "?-format string? " "?-gmt boolean? " @@ -3857,7 +3857,7 @@ ClockAddObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now ?number units?..." + Tcl_WrongNumArgs(interp, 0, NULL, "clock add clockval|-now ?number units?..." "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); @@ -4014,7 +4014,7 @@ ClockSecondsObjCmd( Tcl_Time now; if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock seconds"); return TCL_ERROR; } Tcl_GetTime(&now); diff --git a/tests/clock.test b/tests/clock.test index 9e86c97..214d4cb 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -257,6 +257,10 @@ test clock-1.0 "clock format - wrong # args" { list [catch {clock format} msg] $msg $::errorCode } {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} +test clock-1.0.1 "clock format - wrong # args (compiled ensemble with invalid syntax)" { + list [catch {clock format 0 -too-few-options-4-test} msg] $msg $::errorCode +} {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} + test clock-1.1 "clock format - bad time" { list [catch {clock format foo} msg] $msg } {1 {expected integer but got "foo"}} |