Index: tests/aliastest.xotcl =================================================================== diff -u -rd337d1f94a287b8d694b50c4b1000151de21098c -r81c800c8b9cb42ef6743d9b80ac2be5ca211a69a --- tests/aliastest.xotcl (.../aliastest.xotcl) (revision d337d1f94a287b8d694b50c4b1000151de21098c) +++ tests/aliastest.xotcl (.../aliastest.xotcl) (revision 81c800c8b9cb42ef6743d9b80ac2be5ca211a69a) @@ -5,11 +5,11 @@ Test case alias-preliminaries { # The system methods of Object are either alias or forwarders - ? {lsort [::xotcl::ObjectParameterSlot info methods -methodtype alias]} {assign get} - ? {::xotcl::ObjectParameterSlot info method definition get} "::xotcl::ObjectParameterSlot alias get ::xotcl::setvar" + ? {lsort [::next::ObjectParameterSlot info methods -methodtype alias]} {assign get} + ? {::next::ObjectParameterSlot info method definition get} "::next::ObjectParameterSlot alias get ::next::core::setvar" # define an alias and retrieve its definition - set cmd "::xotcl2::Object alias -objscope set ::set" + set cmd "::next::Object alias -objscope set ::set" eval $cmd ? {Object info method definition set} $cmd @@ -22,9 +22,9 @@ } Class create Foo - ::xotcl::alias ::Foo foo ::xotcl::classes::Base::foo + ::next::core::alias ::Foo foo ::next::core::classes::Base::foo - ? {Foo info method definition foo} "::Foo alias foo ::xotcl::classes::Base::foo" + ? {Foo info method definition foo} "::Foo alias foo ::next::core::classes::Base::foo" Foo create f1 ? {f1 foo} 1 @@ -42,7 +42,7 @@ Base method foo {{-x 1}} {return $x} - ::xotcl::alias ::Foo foo ::xotcl::classes::Base::foo + ::next::core::alias ::Foo foo ::next::core::classes::Base::foo ? {Base info methods -methodtype scripted} {foo} "defined again" ? {Foo info methods -methodtype alias} {foo} "aliased again" @@ -63,7 +63,7 @@ T method foo args { return [self class]->[self proc] } - ::xotcl::alias T FOO ::xotcl::classes::T::foo + ::next::core::alias T FOO ::next::core::classes::T::foo ? {t foo} ::T->foo ? {t FOO} ::T->foo @@ -74,28 +74,28 @@ # puts stderr "double indirection" T method foo args { return [self class]->[self proc] } - ::xotcl::alias T FOO ::xotcl::classes::T::foo - ::xotcl::alias S BAR ::xotcl::classes::T::FOO + ::next::core::alias T FOO ::next::core::classes::T::foo + ::next::core::alias S BAR ::next::core::classes::T::FOO ? {T info methods -methodtype alias} "FOO" - ? {T info method definition FOO} "::T alias FOO ::xotcl::classes::T::foo" + ? {T info method definition FOO} "::T alias FOO ::next::core::classes::T::foo" ? {lsort [T info methods]} {FOO foo} ? {S info methods} {BAR} T method FOO {} {} ? {T info methods} {foo} ? {S info methods} {BAR} ? {s BAR} ::S->foo ? {t foo} ::T->foo - ? {S info method definition BAR} "::S alias BAR ::xotcl::classes::T::FOO" + ? {S info method definition BAR} "::S alias BAR ::next::core::classes::T::FOO" T method foo {} {} ? {T info methods} {} ? {S info methods} {} T method foo args { return [self class]->[self proc] } - ::xotcl::alias T FOO ::xotcl::classes::T::foo - ::xotcl::alias S BAR ::xotcl::classes::T::FOO + ::next::core::alias T FOO ::next::core::classes::T::foo + ::next::core::alias S BAR ::next::core::classes::T::FOO ? {lsort [T info methods]} {FOO foo} ? {S info methods} {BAR} @@ -105,9 +105,9 @@ T method foo args { return [self class]->[self proc] } T object method bar args { return [self class]->[self proc] } - ::xotcl::alias T -per-object FOO ::xotcl::classes::T::foo - ::xotcl::alias T -per-object BAR ::T::FOO - ::xotcl::alias T -per-object ZAP ::T::BAR + ::next::core::alias T -per-object FOO ::next::core::classes::T::foo + ::next::core::alias T -per-object BAR ::T::FOO + ::next::core::alias T -per-object ZAP ::T::BAR ? {T info methods} {foo} ? {lsort [T object info methods -methodtype alias]} {BAR FOO ZAP} ? {lsort [T object info methods]} {BAR FOO ZAP bar} @@ -149,8 +149,8 @@ # per-object methods as per-object aliases # T object method m1 args { return [self class]->[self proc] } - ::xotcl::alias T -per-object M1 ::T::m1 - ::xotcl::alias T -per-object M11 ::T::M1 + ::next::core::alias T -per-object M1 ::T::m1 + ::next::core::alias T -per-object M11 ::T::M1 ? {lsort [T object info methods]} {M1 M11 bar m1} ? {T m1} ->m1 ? {T M1} ->m1 @@ -167,12 +167,12 @@ # proc foo args { return [self class]->[self proc] } - ::xotcl::alias T FOO1 ::foo - ::xotcl::alias T -per-object FOO2 ::foo + ::next::core::alias T FOO1 ::foo + ::next::core::alias T -per-object FOO2 ::foo # # ! per-object alias referenced as per-class alias ! # - ::xotcl::alias T BAR ::T::FOO2 + ::next::core::alias T BAR ::T::FOO2 ? {lsort [T object info methods]} {FOO2 bar} ? {lsort [T info methods]} {BAR FOO1} ? {T FOO2} ->foo @@ -200,9 +200,9 @@ proc bar2 args { upvar 2 _ __; return $__} } - ::xotcl::alias T FOO ::ns1::foo - ::xotcl::alias T BAR ::ns1::bar - ::xotcl::alias T BAR2 ::ns1::bar2 + ::next::core::alias T FOO ::ns1::foo + ::next::core::alias T BAR ::ns1::bar + ::next::core::alias T BAR2 ::ns1::bar2 ? {lsort [T info methods]} {BAR BAR2 FOO} set ::_ GOTYA ? {t FOO} ::T->foo @@ -218,12 +218,12 @@ U create u ? {namespace exists ::U} 0 U object method zap args { return [self class]->[self proc] } - ::xotcl::alias ::U -per-object ZAP ::U::zap + ::next::core::alias ::U -per-object ZAP ::U::zap U requireNamespace ? {namespace exists ::U} 1 U object method bar args { return [self class]->[self proc] } - ::xotcl::alias U -per-object BAR ::U::bar + ::next::core::alias U -per-object BAR ::U::bar ? {lsort [U object info methods]} {BAR ZAP bar zap} ? {U BAR} ->bar ? {U ZAP} ->zap @@ -253,10 +253,10 @@ ? {lsort [V info vars]} {z} ? {lsort [v info vars]} {z} - proc ::foo args { return [:bar ${:z}]-[set :z]-[my bar [set :z]] } + proc ::foo args { return [:bar ${:z}]-[set :z]-[:bar [set :z]] } - ::xotcl::alias V FOO1 ::foo - ::xotcl::alias V -per-object FOO2 ::foo + ::next::core::alias V FOO1 ::foo + ::next::core::alias V -per-object FOO2 ::foo ? {lsort [V object info methods]} {FOO2 bar} ? {lsort [V info methods]} {FOO1 bar} @@ -270,15 +270,15 @@ } # -# Tests for the ::xotcl::alias store, used for introspection for +# Tests for the ::next::core::alias store, used for introspection for # aliases. The alias store (an associative variable) is mostly # necessary for for the direct aliases (e.g. aliases to C implemented # tcl commands), for which we have no stubs at the place where the # alias was registered. # # -# structure of the ::xotcl::alias store: +# structure of the ::next::core::alias store: # ,, -> # @@ -287,95 +287,95 @@ o method bar args {;} -? {info vars ::xotcl::alias} ::xotcl::alias -? {array exists ::xotcl::alias} 1 +? {info vars ::next::core::alias} ::next::core::alias +? {array exists ::next::core::alias} 1 proc ::foo args {;} -::xotcl::alias ::o FOO ::foo -::xotcl::alias ::C FOO ::foo -? {info exists ::xotcl::alias(::o,FOO,1)} 1 -? {info exists ::xotcl::alias(::C,FOO,0)} 1 -? {array get ::xotcl::alias ::o,FOO,1} "::o,FOO,1 ::foo" -? {array get ::xotcl::alias ::C,FOO,0} "::C,FOO,0 ::foo" +::next::core::alias ::o FOO ::foo +::next::core::alias ::C FOO ::foo +? {info exists ::next::core::alias(::o,FOO,1)} 1 +? {info exists ::next::core::alias(::C,FOO,0)} 1 +? {array get ::next::core::alias ::o,FOO,1} "::o,FOO,1 ::foo" +? {array get ::next::core::alias ::C,FOO,0} "::C,FOO,0 ::foo" ? {o info method definition FOO} "::o alias FOO ::foo" ? {C info method definition FOO} "::C alias FOO ::foo" -::xotcl::alias o FOO ::o::bar -? {info exists ::xotcl::alias(::o,FOO,1)} 1 -? {array get ::xotcl::alias ::o,FOO,1} "::o,FOO,1 ::o::bar" +::next::core::alias o FOO ::o::bar +? {info exists ::next::core::alias(::o,FOO,1)} 1 +? {array get ::next::core::alias ::o,FOO,1} "::o,FOO,1 ::o::bar" ? {o info method definition FOO} "::o alias FOO ::o::bar" # AliasDelete in XOTclRemoveObjectMethod o method FOO {} {} -? {info exists ::xotcl::alias(::o,FOO,1)} 0 -? {array get ::xotcl::alias ::o,FOO,1} "" +? {info exists ::next::core::alias(::o,FOO,1)} 0 +? {array get ::next::core::alias ::o,FOO,1} "" ? {o info method definition FOO} "" # AliasDelete in XOTclRemoveClassMethod C method FOO {} {} -? {info exists ::xotcl::alias(::C,FOO,0)} 0 -? {array get ::xotcl::alias ::C,FOO,0} "" +? {info exists ::next::core::alias(::C,FOO,0)} 0 +? {array get ::next::core::alias ::C,FOO,0} "" ? {C info method definition FOO} "" -::xotcl::alias ::o BAR ::foo -::xotcl::alias ::C BAR ::foo +::next::core::alias ::o BAR ::foo +::next::core::alias ::C BAR ::foo # AliasDelete in XOTclAddObjectMethod -? {info exists ::xotcl::alias(::o,BAR,1)} 1 +? {info exists ::next::core::alias(::o,BAR,1)} 1 ::o method BAR {} {;} -? {info exists ::xotcl::alias(::o,BAR,1)} 0 +? {info exists ::next::core::alias(::o,BAR,1)} 0 # AliasDelete in XOTclAddInstanceMethod -? {info exists ::xotcl::alias(::C,BAR,0)} 1 +? {info exists ::next::core::alias(::C,BAR,0)} 1 ::C method BAR {} {;} -? {info exists ::xotcl::alias(::C,BAR,0)} 0 +? {info exists ::next::core::alias(::C,BAR,0)} 0 # AliasDelete in aliasCmdDeleteProc -::xotcl::alias o FOO ::foo -? {info exists ::xotcl::alias(::o,FOO,1)} 1 +::next::core::alias o FOO ::foo +? {info exists ::next::core::alias(::o,FOO,1)} 1 rename ::foo "" -? {info exists ::xotcl::alias(::o,FOO,1)} 0 +? {info exists ::next::core::alias(::o,FOO,1)} 0 -::xotcl::alias o FOO ::o::bar -::xotcl::alias o BAR ::o::FOO -? {info exists ::xotcl::alias(::o,FOO,1)} 1 -? {info exists ::xotcl::alias(::o,BAR,1)} 1 +::next::core::alias o FOO ::o::bar +::next::core::alias o BAR ::o::FOO +? {info exists ::next::core::alias(::o,FOO,1)} 1 +? {info exists ::next::core::alias(::o,BAR,1)} 1 o method bar {} {} -? {info exists ::xotcl::alias(::o,FOO,1)} 0 -? {info exists ::xotcl::alias(::o,BAR,1)} 0 +? {info exists ::next::core::alias(::o,FOO,1)} 0 +? {info exists ::next::core::alias(::o,BAR,1)} 0 # # pulling the rug out from the proc-alias deletion mechanism # proc ::foo args {;} -::xotcl::alias C FOO ::foo -? {info exists ::xotcl::alias(::C,FOO,0)} 1 -unset ::xotcl::alias(::C,FOO,0) -? {info exists ::xotcl::alias(::C,FOO,0)} 0 +::next::core::alias C FOO ::foo +? {info exists ::next::core::alias(::C,FOO,0)} 1 +unset ::next::core::alias(::C,FOO,0) +? {info exists ::next::core::alias(::C,FOO,0)} 0 ? {C info method definition FOO} "" ? {C info methods -methodtype alias} FOO rename ::foo "" ? {C info methods -methodtype alias} "" -? {info exists ::xotcl::alias(::C,FOO,0)} 0 +? {info exists ::next::core::alias(::C,FOO,0)} 0 ? {C info method definition FOO} "" # # test renaming of Tcl proc (actually sensed by the alias, though not # reflected by the alias definition store) # a) is this acceptable? -# b) sync ::xotcl::alias upon "info method definition" calls? is this feasible, +# b) sync ::next::core::alias upon "info method definition" calls? is this feasible, # e.g. through rename traces? # C create c proc ::foo args { return [self]->[self proc]} -? {info exists ::xotcl::alias(::C,FOO,0)} 0 -::xotcl::alias C FOO ::foo -? {info exists ::xotcl::alias(::C,FOO,0)} 1 +? {info exists ::next::core::alias(::C,FOO,0)} 0 +::next::core::alias C FOO ::foo +? {info exists ::next::core::alias(::C,FOO,0)} 1 ? {C info methods -methodtype alias} FOO rename ::foo ::foo2 -? {info exists ::xotcl::alias(::C,FOO,0)} 1 +? {info exists ::next::core::alias(::C,FOO,0)} 1 ? {C info methods -methodtype alias} FOO ? {c FOO} ::c->foo2 ? {C info method definition FOO} "::C alias FOO ::foo"; # should be ::foo2 (!)