Index: TODO =================================================================== diff -u -rfe643dd6330cf3deb036335f20ce4113a2e2aee3 -red9fb67f4304d4e03ce35df1e9cbe10eb5e0e183 --- TODO (.../TODO) (revision fe643dd6330cf3deb036335f20ce4113a2e2aee3) +++ TODO (.../TODO) (revision ed9fb67f4304d4e03ce35df1e9cbe10eb5e0e183) @@ -3061,10 +3061,12 @@ - added tests for "variable" + multiplicity and "class variable" - provide error message, when method variable is a noop (e.g. no value provided and no accessor is wanted) +- added tests for object specific "variable" and "attribute + + application defined value checker TODO: - - variable and incremental, test for user-defined types + - variable and incremental - should we change interface for default value in attribute? probably not, same interface is used in methodparameters as well - Should we leave "variable" and "attribute" as it ist? @@ -3082,7 +3084,6 @@ - call user defined setter in object parameters? - maybe use (position == -1) instead of (objectparameter == false) to save common vars - - optimization of plain variable in per-object case - cleanup variable/attribute - testing variable/attribute - maybe change default Index: tests/parameters.test =================================================================== diff -u -rfe643dd6330cf3deb036335f20ce4113a2e2aee3 -red9fb67f4304d4e03ce35df1e9cbe10eb5e0e183 --- tests/parameters.test (.../parameters.test) (revision fe643dd6330cf3deb036335f20ce4113a2e2aee3) +++ tests/parameters.test (.../parameters.test) (revision ed9fb67f4304d4e03ce35df1e9cbe10eb5e0e183) @@ -1862,9 +1862,34 @@ {invalid value in "1 2a 3": expected integer but got "2a"} # useless definition - ? [list [self] variable dummy:int] {Variable definition for 'dummy' (without default and accessor) is useless} + ? [list [self] variable dummy:int] \ + {Variable definition for 'dummy' (without default and accessor) is useless} - # more tests, e.g. user-defined type and incremental + # + # define an application specific converter + # + ::nx::ObjectParameterSlot method type=range {name value arg} { + lassign [split $arg -] min max + if {$value < $min || $value > $max} { + error "Value '$value' of parameter $name not between $min and $max" + } + return $value + } + + # + # Test usage of application specific converter in "variable" and + # "attribute"; invalid value + ? [list [self] variable -nocomplain r1:range,arg=1-10 11] \ + {Value '11' of parameter value not between 1 and 10} + ? [list [self] attribute -nocomplain [list r2:range,arg=1-10 11]] \ + {Value '11' of parameter value not between 1 and 10} + + # valid value + ? [list [self] variable -nocomplain r1:range,arg=1-10 5] "" + ? [list [self] attribute -nocomplain [list r2:range,arg=1-10 5]] \ + {::enterprise::r2} + + # more tests, e.g. incremental } nx::Class create C {