Index: tests/disposition.test =================================================================== diff -u -rcd33e8cefca1d52063ebcb6689e46527bb94e33d -rd9344280c05990c0254aa652a08a09da3e5822b1 --- tests/disposition.test (.../disposition.test) (revision cd33e8cefca1d52063ebcb6689e46527bb94e33d) +++ tests/disposition.test (.../disposition.test) (revision d9344280c05990c0254aa652a08a09da3e5822b1) @@ -26,7 +26,7 @@ # some testing helpers # :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :setObjectParams "" @@ -303,7 +303,7 @@ # The option 'method=...' applies to disposition types only # C setObjectParams [list [list -foo:initcmd,method=BOOM]] - ? {C new} "parameter option 'method=' only allowed for parameter types 'alias' and 'forward'" + ? {C new} "parameter option 'method=' only allowed for parameter types 'alias', 'forward' and 'slotset'" C setObjectParams [list [list -foo:alias,forward]] ? {C new} "parameter option 'forward' not valid in this option combination" @@ -321,10 +321,10 @@ nx::test case dispo-multiplicities { Class create S { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } - #:object method __objectparameter {} { + #:object method __object_configureparameter {} { # return ${:objectparams} #} :public method foo {args} { @@ -384,7 +384,7 @@ nx::test case dispo-returns { Class create R { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -448,7 +448,7 @@ nx::test case dispo-callstack { Class create Callee { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -509,7 +509,7 @@ Callee public object method run {} { set self [self] - set objparams [:__objectparameter] + set objparams [:__object_configureparameter] # # The ? helper by default performs a [namespace eval] in the :: # namespace, so the uplevel|upvar would happen in a different, @@ -587,7 +587,7 @@ # effective difference between #activelevel and #callinglevel, both # skip INACTIVE frames. - Callee mixin [Class new {:public method call args { next }}] + Callee mixin set [Class new {:public method call args { next }}] foreach dispoSpec { {-ah:alias,method=call {call:alias X}} @@ -616,7 +616,7 @@ nx::test case alias-noarg { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :public method foo {args} { @@ -757,7 +757,7 @@ nx::test case alias-noarg { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -772,7 +772,7 @@ nx::test case alias-args { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :public method Residualargs args { @@ -862,7 +862,7 @@ nx::test case alias-init { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } :method init {} { @@ -883,7 +883,7 @@ # Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -955,7 +955,7 @@ } } - C mixin M1 + C mixin set M1 # N+4 |:CscFrame @Type(ENSEMBLE) | <-- foo (leaf) # N+3 |:CscFrame @Call(ENSEMBLE) | <-- FOO (root) @@ -981,11 +981,11 @@ } "::c2--FOO foo--foo" # ... the filter variant ... - C mixin {} + C mixin set {} C public method intercept args { next } - C filter intercept + C filter set intercept # N+4 |:CscFrame @Type(ENSEMBLE) | <-- foo (leaf) # N+3 |:CscFrame @Call(ENSEMBLE) | <-- FOO (root) @@ -1010,7 +1010,7 @@ } "::c2--FOO foo--foo" - C filter "" + C filter set "" # / / / / / / / / / / / / / / / / / / / / / / / / / / / / / # b) Between root and intermittent or inbetween the set of # intermittent frames (i.e., indirection at the level of @@ -1027,7 +1027,7 @@ } } - C::slot::__FOO object mixin M2 + C::slot::__FOO object mixin set M2 ? {C::slot::__FOO foo} "::M2--::C::slot::__FOO--foo--foo" C::slot::__FOO eval {unset :msg} @@ -1037,11 +1037,11 @@ c1 eval {set :msg} } "::c1--FOO foo--foo" - C::slot::__FOO object mixin {} + C::slot::__FOO object mixin set {} C::slot::__FOO public object method intercept {} { return "[current]--[next]" } - C::slot::__FOO object filter intercept + C::slot::__FOO object filter set intercept ? {C::slot::__FOO foo} "::C::slot::__FOO--::C::slot::__FOO--foo--foo" C setObjectParams [list] @@ -1062,7 +1062,7 @@ } } - C mixin M2 + C mixin set M2 # N+4 |:CscFrame @Type(ENSEMBLE) | <-- C.FOO.foo (leaf) # N+2 |:CscFrame @Call(ENSEMBLE) | <-- C.FOO (root) @@ -1077,13 +1077,13 @@ c1 eval {set :msg} } "(1)--::c1--FOO foo--foo--(3)--::M2--FOO foo--::c1" - C mixin {} + C mixin set {} } nx::test case dispo-configure-transparency { Class create C { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -1124,7 +1124,7 @@ C setObjectParams [list [list FOO:alias,noarg ""]] C mixin add M ? {C create c} "::c-FOO" - C mixin {} + C mixin set {} # ... at the called object level @@ -1174,7 +1174,7 @@ Class create C Class create T { :public object method setObjectParams {spec} { - :protected method __objectparameter {} [list return $spec] + :protected method __object_configureparameter {} [list return $spec] ::nsf::parameter:invalidate::classcache [current] } } @@ -1212,7 +1212,7 @@ } - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {[T create t] z uff} "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-uff-PATH-z" \ "Aliased dispatch to unknown method (custom unknown handler)" set x [UnknownHandler create handledObj] @@ -1229,11 +1229,11 @@ # # a) direct dispatch (non-aliased) with fully qualified selector (::*) # - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams x:alias,method=::obj ? {T create t XXX} "::t: unable to dispatch method '::obj'" "FQ dispatch with default unknown handler" - ::T mixin UnknownHandler + ::T mixin set UnknownHandler ? {T create t XXX} "UNKNOWNMETHOD-::obj" "FQ dispatch with custom unknown handler" # @@ -1242,7 +1242,7 @@ UnknownHandler method defaultmethod {} { set :defaultmethod 1 } - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler T setObjectParams [list [list z:alias,noarg ""]] ? {T create t; ::obj eval {info exists :defaultmethod}} 1 \ "Calling defaultmethod via alias+noarg combo with empty default" @@ -1262,29 +1262,29 @@ # ? {T create t XXX} "invalid argument 'XXX', maybe too many arguments; should be \"::t configure ?/z/?\"" - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams [list z:alias] ? {T create tt YYY} "::obj: unable to dispatch method 'YYY'" "sending the msg: tt->z(::obj)->YYY()" - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {T create tt YYY} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD-YYY-PATH-z" \ "sending the msg: tt->z(::obj)->YYY()" - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams [list -z:alias] ? {T create tt -z YYY} "::obj: unable to dispatch method 'YYY'" "sending the msg: tt->z(::obj)->YYY()" - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {T create tt -z YYY} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD-YYY-PATH-z" \ "sending the msg: tt->z(::obj)->YYY()" # # [current methodpath] & empty selector strings: # - ::obj object mixin {} + ::obj object mixin set {} T setObjectParams [list z:alias] ? {T create tt ""} "::obj: unable to dispatch method ''" "sending the msg: tt->z->{}()" - ::obj object mixin UnknownHandler + ::obj object mixin set UnknownHandler ? {T create tt ""} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD--PATH-z" "sending the msg: tt->z->{}()" T setObjectParams [list -z:alias] ? {T create tt -z ""} "CURRENT-::obj-DELEGATOR-::tt-UNKNOWNMETHOD--PATH-z" "sending the msg: tt->z()" @@ -1293,15 +1293,13 @@ # # Dispatch with a method handle # - ::T mixin {} - #puts stderr =================1 + ::T mixin set {} ? [list [T create t] $methods(z) XXX] \ "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-XXX-PATH-::nsf::classes::T::z" - #puts stderr =================3 T setObjectParams x:alias,method=$methods(z) ? {T create t XXX} "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-XXX-PATH-::nsf::classes::T::z" \ "Non-object FQ selector with default unknown handler" - ::T mixin UnknownHandler + ::T mixin set UnknownHandler ? {T create t XXX} "CURRENT-::obj-DELEGATOR-::t-UNKNOWNMETHOD-XXX-PATH-::nsf::classes::T::z" \ "Non-object FQ selector with custom unknown handler" @@ -1331,12 +1329,13 @@ # nx::test case xotcl-residualargs { + package prefer latest puts stderr "XOTcl loaded: [package req XOTcl 2.0]" ? {::xotcl::Class create XD -set x 1} "::XD" #? {c1 eval {info exists :args}} 0 - ? {XD objectparameter} "-instfilter:filterreg,alias,0..n -superclass:alias,0..n -instmixin:mixinreg,alias,0..n {-__default_metaclass ::xotcl::Class} {-__default_superclass ::xotcl::Object} -mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" + ? {XD __object_configureparameter} "-instfilter:filterreg,alias,0..n -superclass:alias,0..n -instmixin:mixinreg,alias,0..n {-__default_metaclass ::xotcl::Class} {-__default_superclass ::xotcl::Object} -mixin:mixinreg,alias,0..n -filter:filterreg,alias,0..n -class:class,alias args:alias,method=residualargs,args" # # test passing arguments to init @@ -1358,15 +1357,15 @@ ::xotcl::Class create XC -parameter {a b c} ::XC instproc init args {set :x $args; incr :y} + ? {XC create xc1 -a 1} ::xc1 + ? {XC create xc2 x y -a 1} ::xc2 + ::nx::Class create C { :property a :property b :property c :method init args {set :x $args; incr :y} } - - ? {XC create xc1 -a 1} ::xc1 - ? {XC create xc2 x y -a 1} ::xc2 ? {C create c1 -a 1} ::c1 ? {xc2 eval {info exists :a}} 1