Index: TODO =================================================================== diff -u -rf2c0f8e055015e58f3fa7bd338c872a2b7d76113 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- TODO (.../TODO) (revision f2c0f8e055015e58f3fa7bd338c872a2b7d76113) +++ TODO (.../TODO) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -2008,6 +2008,12 @@ * C-level: NsfLog() * Tcl-level: ::nsf::log +- quote name of referenced parameter in error message to ease reading +- new parameter checker "parameter", performing an approximate checking + for valid parameter specs +- set NSF_ARG_CHECK_NONPOS only when there are multiple arguments +- remove space checking for NSF_ARG_CHECK_NONPOS in favor of parameter checker + TODO: - "-returns" Index: generic/nsf.c =================================================================== diff -u -rf2c0f8e055015e58f3fa7bd338c872a2b7d76113 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- generic/nsf.c (.../nsf.c) (revision f2c0f8e055015e58f3fa7bd338c872a2b7d76113) +++ generic/nsf.c (.../nsf.c) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -7976,7 +7976,7 @@ } else { result = NsfVarErrMsg(interp, "expected ", ObjStr(pPtr->converterArg), " but got \"", ObjStr(objPtr), - "\" for parameter ", pPtr->name, NULL); + "\" for parameter \"", pPtr->name, "\"", NULL); } } } else { @@ -7986,8 +7986,9 @@ if (*value == '-' && (pPtr->flags & NSF_ARG_CHECK_NONPOS) && isalpha(*(value+1)) - && strchr(value+1, ' ') == 0) { - NsfLog(interp, NSF_LOG_WARN, "Value '%s' of parameter %s could be a non-positional argument", + /* && strchr(value+1, ' ') == 0 */ + ) { + NsfLog(interp, NSF_LOG_WARN, "Value '%s' of parameter '%s' could be a non-positional argument", value, pPtr->name); } } @@ -8016,7 +8017,7 @@ *clientData = (ClientData)INT2PTR(bool); } else { NsfVarErrMsg(interp, "expected boolean value but got \"", ObjStr(objPtr), - "\" for parameter ", pPtr->name, NULL); + "\" for parameter \"", pPtr->name, "\"", NULL); } *outObjPtr = objPtr; return result; @@ -8034,7 +8035,7 @@ *outObjPtr = objPtr; } else { NsfVarErrMsg(interp, "expected integer but got \"", ObjStr(objPtr), - "\" for parameter ", pPtr->name, NULL); + "\" for parameter \"", pPtr->name, "\"", NULL); } return result; } @@ -8113,6 +8114,22 @@ } static int +ConvertToParameter(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, + ClientData *clientData, Tcl_Obj **outObjPtr) { + CONST char *value = ObjStr(objPtr); + + *outObjPtr = objPtr; + /*fprintf(stderr, "convert to parameter '%s' t '%s'\n", value, pPtr->type);*/ + if (*value == ':' || (*value == '-' && *(value + 1) == ':')) { + return NsfObjErrType(interp, objPtr, pPtr->type, pPtr->name); + } + + *clientData = (char *)ObjStr(objPtr); + *outObjPtr = objPtr; + return TCL_OK; +} + +static int ConvertViaCmd(Tcl_Interp *interp, Tcl_Obj *objPtr, NsfParam CONST *pPtr, ClientData *clientData, Tcl_Obj **outObjPtr) { Tcl_Obj *ov[5], *savedResult; @@ -8312,6 +8329,8 @@ result = ParamOptionSetConverter(interp, paramPtr, "relation", ConvertToRelation); paramPtr->flags |= NSF_ARG_RELATION; /*paramPtr->type = "tclobj";*/ + } else if (strncmp(option, "parameter", 9) == 0) { + result = ParamOptionSetConverter(interp, paramPtr, "parameter", ConvertToParameter); } else if (length >= 6 && strncmp(option, "type=", 5) == 0) { if (paramPtr->converter != ConvertToObject && paramPtr->converter != ConvertToClass) @@ -8574,7 +8593,7 @@ return result; } } - if (nrNonposArgs > 0) { + if (nrNonposArgs > 0 && argsc > 1) { for (i=0; i < argsc; i++) { (paramsPtr + i)->flags |= NSF_ARG_CHECK_NONPOS; } @@ -13366,8 +13385,8 @@ if (theobj || thecls) { ObjectSystemFree(interp, osPtr); - NsfLog(interp, NSF_LOG_WARN, "Base %s class exists already; ignoring definition", - theobj ? object : class); + NsfLog(interp, NSF_LOG_WARN, "Base class '%s' exists already; ignoring definition", + theobj ? objectName : className); return TCL_OK; } Index: generic/nsf.decls =================================================================== diff -u -rf2c0f8e055015e58f3fa7bd338c872a2b7d76113 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- generic/nsf.decls (.../nsf.decls) (revision f2c0f8e055015e58f3fa7bd338c872a2b7d76113) +++ generic/nsf.decls (.../nsf.decls) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -88,7 +88,7 @@ int NsfErrBadVal_(Tcl_Interp *interp, char *expected, char *value) } declare 19 generic { - int NsfObjErrType(Tcl_Interp *interp, Tcl_Obj *nm, char *wt, char *parameterName) + int NsfObjErrType(Tcl_Interp *interp, Tcl_Obj *nm, CONST char *type, char *parameterName) } declare 20 generic { void NsfStackDump (Tcl_Interp *interp) Index: generic/nsfDecls.h =================================================================== diff -u -rf2c0f8e055015e58f3fa7bd338c872a2b7d76113 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- generic/nsfDecls.h (.../nsfDecls.h) (revision f2c0f8e055015e58f3fa7bd338c872a2b7d76113) +++ generic/nsfDecls.h (.../nsfDecls.h) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -137,7 +137,7 @@ #define NsfObjErrType_TCL_DECLARED /* 19 */ EXTERN int NsfObjErrType(Tcl_Interp *interp, Tcl_Obj *nm, - char *wt, char *parameterName); + CONST char *type, char *parameterName); #endif #ifndef NsfStackDump_TCL_DECLARED #define NsfStackDump_TCL_DECLARED @@ -247,7 +247,7 @@ void (*nsfDStringPrintf) (Tcl_DString *dsPtr, CONST char *fmt, va_list apSrc); /* 16 */ int (*nsfErrInProc) (Tcl_Interp *interp, Tcl_Obj *objName, Tcl_Obj *clName, CONST char *procName); /* 17 */ int (*nsfErrBadVal_) (Tcl_Interp *interp, char *expected, char *value); /* 18 */ - int (*nsfObjErrType) (Tcl_Interp *interp, Tcl_Obj *nm, char *wt, char *parameterName); /* 19 */ + int (*nsfObjErrType) (Tcl_Interp *interp, Tcl_Obj *nm, CONST char *type, char *parameterName); /* 19 */ void (*nsfStackDump) (Tcl_Interp *interp); /* 20 */ void (*nsfSetObjClientData) (Nsf_Object *obj, ClientData data); /* 21 */ ClientData (*nsfGetObjClientData) (Nsf_Object *obj); /* 22 */ Index: generic/nsfError.c =================================================================== diff -u -rf2c0f8e055015e58f3fa7bd338c872a2b7d76113 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- generic/nsfError.c (.../nsfError.c) (revision f2c0f8e055015e58f3fa7bd338c872a2b7d76113) +++ generic/nsfError.c (.../nsfError.c) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -141,11 +141,12 @@ } extern int -NsfObjErrType(Tcl_Interp *interp, Tcl_Obj *value, char *type, char *parameterName) { +NsfObjErrType(Tcl_Interp *interp, Tcl_Obj *value, CONST char *type, char *parameterName) { Tcl_ResetResult(interp); Tcl_AppendResult(interp,"expected ", type, " but got \"", ObjStr(value), "\"", - parameterName ? " for parameter " : "", + parameterName ? " for parameter \"" : "", parameterName ? parameterName : "", + parameterName ? "\"" : "", (char *) NULL); return TCL_ERROR; } Index: library/nx/nx.tcl =================================================================== diff -u -r892aa579d3cc7195ce90e93d4bf8b70c2909e451 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- library/nx/nx.tcl (.../nx.tcl) (revision 892aa579d3cc7195ce90e93d4bf8b70c2909e451) +++ library/nx/nx.tcl (.../nx.tcl) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -30,7 +30,7 @@ # # get frequenly used primitiva from the next scripting framework # - namespace eval ::nsf {}; # makein pkg indexer happy + namespace eval ::nsf {}; # make pkg indexer happy namespace import ::nsf::next ::nsf::current ::nsf::self # @@ -145,7 +145,7 @@ # define method "method" for Class and Object ::nsf::method Class method { - name arguments -returns body -precondition -postcondition + name arguments:parameter,multivalued -returns body -precondition -postcondition } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} @@ -162,7 +162,7 @@ } ::nsf::method Object method { - name arguments -returns body -precondition -postcondition + name arguments:parameter,multivalued -returns body -precondition -postcondition } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r2767762e5ef68bee6e82cbff0d69f54b01c37a13 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 2767762e5ef68bee6e82cbff0d69f54b01c37a13) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -242,7 +242,7 @@ # define instproc and proc ::nsf::method Class instproc { - name arguments body precondition:optional postcondition:optional + name arguments:parameter,multivalued body precondition:optional postcondition:optional } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} @@ -260,10 +260,10 @@ } # define a minimal implementation of "method" - Object instproc method {name arguments body} { + Object instproc method {name arguments:parameter,multivalued body} { :proc $name $arguments $body } - Class instproc method {-per-object:switch name arguments body} { + Class instproc method {-per-object:switch name arguments:parameter,multivalued body} { if {${per-object}} { :proc $name $arguments $body } else { @@ -331,7 +331,7 @@ # "init" must exist on Object. per default it is empty. Object instproc init args { if {![::nsf::current isnextcall] && [llength $args] > 0 && [::nsf::configure debug] > 0} { - puts stderr "Warning: arguments '$args' to constructor of object [self] are most likely not processed" + ::nsf::log Warning "Arguments '$args' to constructor of object [self] are most likely not processed" } } Index: library/xotcl/tests/slottest.xotcl =================================================================== diff -u -reb82f3d8597d0eb8b6764997660ccc7c535fd339 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision eb82f3d8597d0eb8b6764997660ccc7c535fd339) +++ library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -409,7 +409,7 @@ Person p2 -name "Gustaf" p2 projects add ::project1 -? {p2 projects add ::o1} {expected object of type ::Project but got "::o1" for parameter value} +? {p2 projects add ::o1} {expected object of type ::Project but got "::o1" for parameter "value"} p2 salary 100 ? {catch {p2 salary 100.9}} 1 ? {p2 salary} 100 Index: library/xotcl/tests/testx.xotcl =================================================================== diff -u -rfc4e3f5f6a94ef7324baffab90d58cd7eb513907 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision fc4e3f5f6a94ef7324baffab90d58cd7eb513907) +++ library/xotcl/tests/testx.xotcl (.../testx.xotcl) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -4032,7 +4032,7 @@ catch { o z3 -b abc -- -b } m - errorCheck $m {expected boolean value but got "abc" for parameter -b} "not boolean" + errorCheck $m {expected boolean value but got "abc" for parameter "-b"} "not boolean" set ::r "" #o z4 -c 1 1 Index: tests/info-method.test =================================================================== diff -u -r99bb4b85e4a123d25f8b867b3498171eadaa2015 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- tests/info-method.test (.../info-method.test) (revision 99bb4b85e4a123d25f8b867b3498171eadaa2015) +++ tests/info-method.test (.../info-method.test) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -49,7 +49,7 @@ {::C public method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2} ? {C info method parameter m} {x} ? {nx::Class info method parameter method} \ - {name arguments -returns body -precondition -postcondition} + {name arguments:parameter,multivalued -returns body -precondition -postcondition} ? {nx::Object info method parameter alias} \ {methodName -returns {-frame default} cmd} # raises currently an error Index: tests/parameters.test =================================================================== diff -u -r99bb4b85e4a123d25f8b867b3498171eadaa2015 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- tests/parameters.test (.../parameters.test) (revision 99bb4b85e4a123d25f8b867b3498171eadaa2015) +++ tests/parameters.test (.../parameters.test) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -41,17 +41,17 @@ ? {::nsf::is object o1} 1 ? {::nsf::is object o1} 1 ? {::nsf::is object o1000} 0 - ? {::nsf::is -complain object o1000} {expected object but got "o1000" for parameter value} + ? {::nsf::is -complain object o1000} {expected object but got "o1000" for parameter "value"} ? {::nsf::is integer 1} 1 ? {::nsf::is object,type=::C c1} 1 - ? {::nsf::is -complain object,type=::C o} {expected object but got "o" for parameter value} + ? {::nsf::is -complain object,type=::C o} {expected object but got "o" for parameter "value"} ? {::nsf::is object,type=::C o} 0 ? {c1 info has mixin ::M} 1 - ? {c1 info has mixin ::M1} {expected class but got "::M1" for parameter class} + ? {c1 info has mixin ::M1} {expected class but got "::M1" for parameter "class"} ? {c1 info has type C} 1 - ? {c1 info has type C1} {expected class but got "C1" for parameter class} + ? {c1 info has type C1} {expected class but got "C1" for parameter "class"} ? {c1 ::nsf::methods::object::info::hastype C} 1 ? {::nsf::dispatch c1 ::nsf::methods::object::info::hastype C} 1 @@ -96,20 +96,20 @@ ? {::nsf::is metaclass ::nx::Class} 1 ? {::nsf::is metaclass ::nx::Object} 0 - ? {::nsf::is -complain class o1} {expected class but got "o1" for parameter value} + ? {::nsf::is -complain class o1} {expected class but got "o1" for parameter "value"} ? {::nsf::is class o1} 0 ? {::nsf::is -complain class Test} 1 ? {::nsf::is -complain object,multivalued [list o1 Test]} 1 ? {::nsf::is -complain integer,multivalued [list 1 2 3]} 1 ? {::nsf::is -complain integer,multivalued [list 1 2 3 a]} \ - {invalid value in "1 2 3 a": expected integer but got "a" for parameter value} + {invalid value in "1 2 3 a": expected integer but got "a" for parameter "value"} ? {::nsf::is -complain object,type=::C c1} 1 ? {::nsf::is -complain object,type=::C o} \ - {expected object but got "o" for parameter value} \ + {expected object but got "o" for parameter "value"} \ "object, but different type" ? {::nsf::is -complain object,type=::C c} \ - {expected object but got "c" for parameter value} \ + {expected object but got "c" for parameter "value"} \ "no object" ? {::nsf::is -complain object,type=::nx::Object c1} 1 "general type" @@ -118,7 +118,7 @@ ? {::nsf::is -complain lower c} 1 "lower case char" ? {::nsf::is -complain lower abc} 1 "lower case chars" - ? {::nsf::is -complain lower Abc} {expected lower but got "Abc" for parameter value} + ? {::nsf::is -complain lower Abc} {expected lower but got "Abc" for parameter "value"} ? {string is lower abc} 1 "tcl command 'string is lower'" ? {::nsf::is -complain {i:integer 1} 2} {invalid value constraints "i:integer 1"} @@ -329,7 +329,7 @@ ? {D create d1} "::d1 configure: required argument 'd' is missing" "check error msg" ? {D create d2 -d x -b a} \ - {expected boolean value but got "a" for parameter -b} \ + {expected boolean value but got "a" for parameter "-b"} \ "create d2 without required argument given" D create d1 -d 1 @@ -342,31 +342,31 @@ "call method without a required argument" ? {d1 foo -r a} \ - {expected integer but got "a" for parameter -r} \ + {expected integer but got "a" for parameter "-r"} \ "required argument is not integer" ? {d1 foo -r 1} \ - {expected integer but got "aaa" for parameter -x} \ + {expected integer but got "aaa" for parameter "-x"} \ "default value is not of type integer" ? {d1 foo -r 1 -x 1 -object d1} \ "" \ "pass object" ? {d1 foo -r 1 -x 1 -object d11} \ - {expected object but got "d11" for parameter -object} \ + {expected object but got "d11" for parameter "-object"} \ "pass non-existing object" ? {d1 foo -r 1 -x 1 -class D} \ "" \ "pass class" ? {d1 foo -r 1 -x 1 -class d1} \ - {expected class but got "d1" for parameter -class} \ + {expected class but got "d1" for parameter "-class"} \ "pass object instead of class" ? {d1 foo -r 1 -x 1 -class D11} \ - {expected class but got "D11" for parameter -class} \ + {expected class but got "D11" for parameter "-class"} \ "pass non-existing class" ? {D public method foo {a:relation} {}} \ @@ -378,7 +378,7 @@ "allow 'string is XXXX' for argument checking" ? {d1 foo 1} 1 "check int as double" ? {d1 foo 1.1} 1.1 "check double as double" - ? {d1 foo 1.1a} {expected double but got "1.1a" for parameter a} "check non-double as double" + ? {d1 foo 1.1a} {expected double but got "1.1a" for parameter "a"} "check non-double as double" ? {D info method parameter foo} a:double } @@ -420,7 +420,7 @@ ? {d1 foo 1} "1" "single value" ? {d1 foo {1 2}} "1 2" "multiple values" ? {d1 foo {1 a 2}} \ - {invalid value in "1 a 2": expected integer but got "a" for parameter m} \ + {invalid value in "1 a 2": expected integer but got "a" for parameter "m"} \ "multiple values with wrong value" D public method foo {m:object,multivalued} { @@ -429,14 +429,14 @@ ? {d1 foo ""} "" "emtpy list" ? {d1 foo o} "o" "single value" ? {d1 foo {o d1 x}} \ - {invalid value in "o d1 x": expected object but got "x" for parameter m} \ + {invalid value in "o d1 x": expected object but got "x" for parameter "m"} \ "multiple values" Class create Foo -attributes { {ints:integer,multivalued} } ? {Foo create foo -ints {1 2}} "::foo" - ? {Foo create foo -ints {1 a 2}} {invalid value in "1 a 2": expected integer but got "a" for parameter -ints} + ? {Foo create foo -ints {1 a 2}} {invalid value in "1 a 2": expected integer but got "a" for parameter "-ints"} # make slot incremental Foo::slot::ints eval { @@ -446,7 +446,7 @@ Foo create foo -ints {1 2} ? {foo ints add 0} "0 1 2" - ? {foo ints add a} {expected integer but got "a" for parameter value} + ? {foo ints add a} {expected integer but got "a" for parameter "value"} } ####################################################### @@ -562,7 +562,7 @@ "query instparams with default, no paramdefs needed" ? {Class info method parameter method} \ - "name arguments -returns body -precondition -postcondition" \ + "name arguments:parameter,multivalued -returns body -precondition -postcondition" \ "query instparams for scripted method 'method'" ? {Object info method parameter ::nsf::forward} \ @@ -702,31 +702,31 @@ ? {d1 foo-base ::nx::Object} "::nx::Object" ? {d1 foo-base C} \ - {expected baseclass but got "C" for parameter x} \ + {expected baseclass but got "C" for parameter "x"} \ "not a base class" ? {d1 foo-class D} "D" ? {d1 foo-class xxx} \ - {expected class but got "xxx" for parameter x} \ + {expected class but got "xxx" for parameter "x"} \ "not a class" ? {d1 foo-class o} \ - {expected class but got "o" for parameter x} \ + {expected class but got "o" for parameter "x"} \ "not a class" ? {d1 foo-meta ::nx::Class} "::nx::Class" ? {d1 foo-meta ::nx::Object} \ - {expected metaclass but got "::nx::Object" for parameter x} \ + {expected metaclass but got "::nx::Object" for parameter "x"} \ "not a base class" ? {d1 foo-object o} "o" ? {d1 foo-object xxx} \ - {expected object but got "xxx" for parameter x} \ + {expected object but got "xxx" for parameter "x"} \ "not an object" ? {d1 foo-type d1} "d1" ? {d1 foo-type c1} "c1" ? {d1 foo-type o} \ - {expected object of type ::C but got "o" for parameter x} \ + {expected object of type ::C but got "o" for parameter "x"} \ "o not of type ::C" } @@ -758,17 +758,17 @@ ? {s1 bar} 1 ? {s1 bar 3} 3 - ? {s1 bar a} {expected integer but got "a" for parameter y} + ? {s1 bar a} {expected integer but got "a" for parameter "y"} - ? {s1 baz} {expected integer but got "b" for parameter x} + ? {s1 baz} {expected integer but got "b" for parameter "x"} ? {s1 baz 20} 20 s1 y 100 ? {s1 baz} 100 ? {s1 baz 101} 101 ? {s1 boz} {1 2 3} s1 z {1 x 100} - ? {s1 boz} {invalid value in "1 x 100": expected integer but got "x" for parameter x} + ? {s1 boz} {invalid value in "1 x 100": expected integer but got "x" for parameter "x"} ? {s1 boz {100 200}} {100 200} set ::aaa 100 @@ -861,35 +861,35 @@ ? {ParamTest create p -o o} ::p ? {ParamTest create p -o xxx} \ - {expected object but got "xxx" for parameter -o} \ + {expected object but got "xxx" for parameter "-o"} \ "not an object" ? {ParamTest create p -c C} ::p "class" ? {ParamTest create p -c o} \ - {expected class but got "o" for parameter -c} \ + {expected class but got "o" for parameter "-c"} \ "not a class" ? {ParamTest create p -c1 MC1} ::p "instance of meta-class MC" ? {ParamTest create p -c1 C} \ - {expected class of type ::MC but got "C" for parameter -c1} \ + {expected class of type ::MC but got "C" for parameter "-c1"} \ "not an instance of meta-class MC" ? {ParamTest create p -d d1} ::p ? {ParamTest create p -d1 d1} ::p ? {ParamTest create p -d c1} ::p ? {ParamTest create p -d o} \ - {expected object of type ::C but got "o" for parameter -d} \ + {expected object of type ::C but got "o" for parameter "-d"} \ "o not of type ::C" #? {ParamTest create p -mix c1} ::p #? {ParamTest create p -mix o} \ - {expected object with mixin M but got "o" for parameter mix} \ + {expected object with mixin M but got "o" for parameter "mix"} \ "does not have mixin M" ? {ParamTest create p -u A} ::p - ? {ParamTest create p -u c1} {expected upper but got "c1" for parameter -u} + ? {ParamTest create p -u c1} {expected upper but got "c1" for parameter "-u"} ? {ParamTest create p -us {A B c}} \ - {invalid value in "A B c": expected upper but got "c" for parameter -us} + {invalid value in "A B c": expected upper but got "c" for parameter "-us"} ParamTest::slot::us eval { set :incremental 1 :optimize @@ -902,7 +902,7 @@ "value is an object" ? {p o xxx} \ - {expected object but got "xxx" for parameter o} \ + {expected object but got "xxx" for parameter "o"} \ "value is not an object" #ParamTest slots { @@ -923,7 +923,7 @@ "value is a list of objects (multiple elements)" ? {p os {o xxx d1}} \ - {invalid value in "o xxx d1": expected object but got "xxx" for parameter os} \ + {invalid value in "o xxx d1": expected object but got "xxx" for parameter "os"} \ "list with invalid object" } @@ -1002,14 +1002,14 @@ ? {o foo 1 2 {o1 o2}} 1 "all values specified" ? {o foo "" 2 {o1 o2}} "" "first is empty" - ? {o foo 1 "" {o1 o2}} {expected integer but got "" for parameter y} "second is empty" + ? {o foo 1 "" {o1 o2}} {expected integer but got "" for parameter "y"} "second is empty" ? {o foo 1 2 {}} 1 "empty list, does not require allowempty" ? {o foo 1 2 {o1 "" o2}} 1 "list contains empty value" ? {o info method parameter foo} "x:integer,allowempty y:integer os:object,multivalued,allowempty" o public method foo {x:integer,allowempty y:integer os:object,multivalued} {return $x} - ? {o foo 1 2 {o1 "" o2}} {invalid value in "o1 "" o2": expected object but got "" for parameter os} \ + ? {o foo 1 2 {o1 "" o2}} {invalid value in "o1 "" o2": expected object but got "" for parameter "os"} \ "list contains empty value" } @@ -1071,10 +1071,10 @@ ? {o info method args o} "o" ? {o a 2} 2 - ? {o a hugo} {expected integer but got "hugo" for parameter a} + ? {o a hugo} {expected integer but got "hugo" for parameter "a"} ? {o ints {10 100 1000}} {10 100 1000} - ? {o ints hugo} {invalid value in "hugo": expected integer but got "hugo" for parameter ints} + ? {o ints hugo} {invalid value in "hugo": expected integer but got "hugo" for parameter "ints"} ? {o o o} o ? {::nsf::setter o {d default}} {parameter "d" is not allowed to have default "default"} ? {::nsf::setter o -x} {invalid setter name "-x" (must not start with a dash or colon)} @@ -1136,19 +1136,19 @@ ? {f1 onearg 1} 1 # built-in checker ? {f1 intarg 1} 1 - ? {f1 intarg a} {expected integer but got "a" for parameter x} + ? {f1 intarg a} {expected integer but got "a" for parameter "x"} ? {f1 intsarg {10 11 12}} {10 11 12} - ? {f1 intsarg {10 11 1a2}} {invalid value in "10 11 1a2": expected integer but got "1a2" for parameter x} + ? {f1 intsarg {10 11 1a2}} {invalid value in "10 11 1a2": expected integer but got "1a2" for parameter "x"} ? {f1 boolarg 1} 1 - ? {f1 boolarg a} {expected boolean value but got "a" for parameter x} + ? {f1 boolarg a} {expected boolean value but got "a" for parameter "x"} ? {f1 classarg ::Foo} ::Foo - ? {f1 classarg f1} {expected class but got "f1" for parameter x} + ? {f1 classarg f1} {expected class but got "f1" for parameter "x"} # tcl checker ? {f1 upperarg ABC} ABC - ? {f1 upperarg abc} {expected upper but got "abc" for parameter x} + ? {f1 upperarg abc} {expected upper but got "abc" for parameter "x"} # scripted checker ? {f1 metaclassarg ::nx::Class} ::nx::Class - ? {f1 metaclassarg ::Foo} {expected metaclass but got "::Foo" for parameter x} + ? {f1 metaclassarg ::Foo} {expected metaclass but got "::Foo" for parameter "x"} } Test case slot-traces { Index: tests/returns.test =================================================================== diff -u -r6b039871ad08a490bb975e3ddd713177f6dd9ea9 -rcd96543a3a6fb25ec8e52548892d12d244208a1a --- tests/returns.test (.../returns.test) (revision 6b039871ad08a490bb975e3ddd713177f6dd9ea9) +++ tests/returns.test (.../returns.test) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) @@ -33,12 +33,12 @@ ? {c1 bar-ok1 1 2} 1 ? {c1 bar-ok2 1 2} 1 - ? {c1 bar-nok 1 2} {expected integer but got "a" for parameter return-value} + ? {c1 bar-nok 1 2} {expected integer but got "a" for parameter "return-value"} ? {c1 incr x} 1 ? {c1 incr x} 10002 - ? {c1 lappend l e1} {expected integer but got "e1" for parameter return-value} + ? {c1 lappend l e1} {expected integer but got "e1" for parameter "return-value"} # query the returns value ? {::nsf::methodproperty C lappend returns} integer @@ -318,14 +318,14 @@ ? {c1 bar-ok1 1 2} 1 ? {c1 bar-ok2 1 2} 1 ? {c1 ++ 1000} 1001 - ? {c1 | a} {expected integer but got "a" for parameter return-value} + ? {c1 | a} {expected integer but got "a" for parameter "return-value"} ? {::nsf::methodproperty ::C ::nsf::classes::C::bar-nok returns} integer - ? {c1 bar-nok 1 2} {expected integer but got "a" for parameter return-value} + ? {c1 bar-nok 1 2} {expected integer but got "a" for parameter "return-value"} ? {c1 incr x} 1 ? {c1 incr x} 1002 - ? {c1 lappend l e1} {expected integer but got "e1" for parameter return-value} + ? {c1 lappend l e1} {expected integer but got "e1" for parameter "return-value"} # query the returns value ? {::nsf::methodproperty C lappend returns} integer