Index: TODO =================================================================== diff -u -rdb0c88f1e6924f14fe33f52ddf935343c8a11d12 -rc00e6abc0c78284c5aef12eb2ca80e3d852b079c --- TODO (.../TODO) (revision db0c88f1e6924f14fe33f52ddf935343c8a11d12) +++ TODO (.../TODO) (revision c00e6abc0c78284c5aef12eb2ca80e3d852b079c) @@ -1166,11 +1166,11 @@ - changed XOTcl info to new interface - reanimated 5 tests in xotcl/tests/testx.xotcl +- reanimated 5 tests in tests/destroytest.tcl TODO: - check "my" vs. "nsf::dispatch" in xotcl2.tcl - overthink decision about not showing "child objects" per default in "info methods" -- continue migration nx in regression test - deeper analysis of "contains" - unify SubcmdObj() and ParamCheckObj() handling? @@ -1181,7 +1181,6 @@ * handle introspection for subcmd nicely * handle absence of -create flag in resolve_method_path (for introspection) * consider alternate method name/place for subcmds on classes - * provide new tests for "TODO: changed xxxx" - aliases on procs are a problem, when upvar is used (see info default/instdefault in xotcl2.tcl) Index: tests/destroytest.tcl =================================================================== diff -u -r76fadfb3f603f8f96a6064f4bb5342133923ec53 -rc00e6abc0c78284c5aef12eb2ca80e3d852b079c --- tests/destroytest.tcl (.../destroytest.tcl) (revision 76fadfb3f603f8f96a6064f4bb5342133923ec53) +++ tests/destroytest.tcl (.../destroytest.tcl) (revision c00e6abc0c78284c5aef12eb2ca80e3d852b079c) @@ -5,7 +5,6 @@ ::nsf::alias ::nx::Object set -objscope ::set - Class create O -superclass Object { :method init {} { set ::ObjectDestroy 0 @@ -425,31 +424,31 @@ ? "set ::ObjectDestroy" 1 "ObjectDestroy called" # -set case "nesting destroy" -Test case nesting-destroy -Object create x -Object create x::y -x destroy -? {::nsf::objectproperty x object} 0 "parent object gone" -? {::nsf::objectproperty x::y object} 0 "child object gone" +Test case nesting-destroy { + Object create x + Object create x::y + x destroy + ? {::nsf::objectproperty x object} 0 "parent object gone" + ? {::nsf::objectproperty x::y object} 0 "child object gone" +} -set case "deleting aliased object" -Test case deleting-aliased-object -Object create o -Object create o2 -::nsf::alias o x o2 -? {o x} ::o2 "call object via alias" -## TODO: changed xxxx -#? {o x info vars} "" "call info on aliased object" -? {o2 set x 10} 10 "set variable on object" -? {o2 info vars} x "query vars" -## TODO: changed xxxx -#? {o x info vars} x "query vars via alias" -#? {o x set x} 10 "set var via alias" -o2 destroy -? {o x info vars} "Trying to dispatch deleted object via method 'x'" "1st call on deleted object" -? {o x info vars} "::o: unable to dispatch method 'x'" "2nd call on deleted object" -o destroy +Test case deleting-aliased-object { + Object create o + Object create o2 + ::nsf::alias o x o2 + ? {o x} ::o2 "call object via alias" + ## the forwarded object needs a per-object methods + o2 method info args next + o2 method set args next + ? {o x info vars} "" "call info on aliased object" + ? {o set x 10} 10 "set variable on object" + ? {o info vars} x "query vars" + ? {o x info vars} x "query vars via alias" + ? {o x set x} 10 "set var via alias" + o2 destroy + ? {o x info vars} "Trying to dispatch deleted object via method 'x'" "1st call on deleted object" + ? {o x info vars} "::o: unable to dispatch method 'x'" "2nd call on deleted object" +} set case "deleting object with alias to object" Test case deleting-object-with-alias-to-object @@ -471,54 +470,56 @@ ? {::nsf::objectproperty o3 object} 0 "aliased object destroyed" o destroy -set case "create an alias, and recreate obj" -Test case create-alias-and-recreate-obj -Object create o -Object create o3 -::nsf::alias o x o3 -Object create o3 -o3 set a 13 -## TODO: changed xxxx -#? {o x set a} 13 "aliased object works after recreate" -o destroy +# +# create an alias, and recreate obj +# +Test case create-alias-and-recreate-obj { + Object create o + Object create o3 + o alias x o3 + Object create o3 + o3 method set args next + o set a 13 + ? {o x set a} 13 "aliased object works after recreate" +} -set case "create an alias on the class level, double aliasing, delete aliased object" -Test case create-alias-on-class-delete-aliased-obj -Class create C -Object create o -Object create o3 -::nsf::alias o a o3 -::nsf::alias C b o -C create c1 -## TODO: changed xxxx -#? {c1 b set B 2} 2 "call 1st level" -#? {c1 b a set A 3} 3 "call 2nd level" +# +# create an alias on the class level, double aliasing, delete aliased +# object +# +Test case create-alias-on-class-delete-aliased-obj { + Class create C + Object create o + Object create o3 + o alias a o3 + C alias b o + o3 method set args next + o method set args next + C create c1 + ? {c1 b set B 2} 2 "call 1st level" + ? {c1 b a set A 3} 3 "call 2nd level" + + ? {c1 set B} 2 "call 1st level ok" + ? {c1 set A} 3 "call 2nd level ok" + o destroy + ? {c1 b} "Trying to dispatch deleted object via method 'b'" "call via alias to deleted object" +} -## TODO: changed xxxx -#? {o set B} 2 "call 1st level ok" -#? {o3 set A} 3 "call 2nd level ok" -o destroy -? {c1 b} "Trying to dispatch deleted object via method 'b'" "call via alias to deleted object" -C destroy -c1 destroy -o3 destroy +# +# create an alias on the class level, double aliasing, destroy class +# +Test case create-alias-on-class-destroy-class { + Class create C + Object create o + Object create o3 + o alias a o3 + C alias b o + C create c1 + C destroy + ? {::nsf::objectproperty o object} 1 "object o still here" + ? {::nsf::objectproperty o3 object} 1 "object o3 still here" +} -set case "create an alias on the class level, double aliasing, destroy class" -Test case create-alias-on-class-destroy-class -Class create C -Object create o -Object create o3 -::nsf::alias o a o3 -::nsf::alias C b o -C create c1 -C destroy -? {::nsf::objectproperty o object} 1 "object o still here" -? {::nsf::objectproperty o3 object} 1 "object o3 still here" -o destroy -o3 destroy -c1 destroy - - # # test cases where preexisting namespaces are re-used #