Index: tests/interp.test =================================================================== diff -u -r6d831cc09c3eea83a17baa5ef05dfeb79b05836e -r929db54ebd7cf84befee362a94c1b9e1a32a041d --- tests/interp.test (.../interp.test) (revision 6d831cc09c3eea83a17baa5ef05dfeb79b05836e) +++ tests/interp.test (.../interp.test) (revision 929db54ebd7cf84befee362a94c1b9e1a32a041d) @@ -5,7 +5,7 @@ puts ">>> traceStderr HA! $args" } -nx::Test case hidden-cmds { +nx::test case hidden-cmds { global i # @@ -31,8 +31,8 @@ # nested objects are not concerned ... # $i eval {nx::Object create ::o { - :public method baz {} { return KO } - :public method destroy {} { + :public object method baz {} { return KO } + :public object method destroy {} { # # sets a global variable for tracing the processing of the # app-level destructor! @@ -84,7 +84,7 @@ ? {interp eval $i {::C create ::c}} ::c # set some relationships to test later ... ? {interp eval $i {::C mixin add ::M}} ::M - ? {interp eval $i {::C class mixin add ::M}} ::M + ? {interp eval $i {::C object mixin add ::M}} ::M $i hide C ? {interp eval $i {::C create ::c2}} {invalid command name "::C"} @@ -160,14 +160,14 @@ # # Explicit destruction # -nx::Test case hidden-cmds+explicit-delete { +nx::test case hidden-cmds+explicit-delete { global i set i [interp create] $i eval { package req nx nx::Object create ::o2 { - :public method destroy {} { + :public object method destroy {} { next return ok } @@ -198,18 +198,18 @@ # # hide and re-expose # -nx::Test case hide-and-re-expose { +nx::test case hide-and-re-expose { global i set i [interp create] $i eval { package req nx nx::Object create ::o { - :public method destroy {} { + :public object method destroy {} { incr ::[namespace tail [current]] return OK } - :public method foo {} { + :public object method foo {} { return [list [current object] [current class] [:info class] [[current] info class]] } } @@ -251,18 +251,18 @@ # # hide/re-expose with "command renaming" # -nx::Test case command-renaming { +nx::test case command-renaming { global i set i [interp create] $i eval { package req nx nx::Object create ::o { - :public method destroy {} { + :public object method destroy {} { incr ::[namespace tail [current]] return OK } - :public method foo {} { + :public object method foo {} { catch {[current] info class} msg return [list [current object] [current class] [:info class] $msg] } @@ -309,15 +309,15 @@ # # Rename namespaced object to global one and hide ... # -nx::Test case namespaced-object { +nx::test case namespaced-object { global i set i [interp create] $i eval { package req nx namespace eval ::ns1 { nx::Object create o { - :public method destroy {} { + :public object method destroy {} { incr ::[namespace tail [current]] return OK } @@ -354,22 +354,22 @@ # Deletion order # -nx::Test case deletion-order { +nx::test case deletion-order { global i set i [interp create] $i eval { package req nx nx::Object create ::o { - :public method destroy {} { + :public object method destroy {} { incr ::[namespace tail [current]] interp invokehidden {} C destroy next } } nx::Class create ::C { - :public class method destroy {} { + :public object method destroy {} { incr ::[namespace tail [current]] next } @@ -391,14 +391,14 @@ # # Some stumbling blocks in destructors: [error] in app-level destroy # -nx::Test case error-in-destroy-1 { +nx::test case error-in-destroy-1 { global i set i [interp create] $i eval { package req nx nx::Object create ::o { - :public method destroy {} { + :public object method destroy {} { error BAFF! } } @@ -427,7 +427,7 @@ # Some stumbling blocks in destructors: [interp hide] in app-level # destroy # -nx::Test case error-in-destroy-2 { +nx::test case error-in-destroy-2 { global i set i [interp create] @@ -439,7 +439,7 @@ } nx::Object create ::o { - :public method destroy {} { + :public object method destroy {} { # # Would not be an issue in safe interps, as [interp hide] & # friends are disallowed ... @@ -471,14 +471,14 @@ # # Some stumbling blocks in destructors: [interp hide] in app-level destroy # -nx::Test case error-in-destroy-3 { +nx::test case error-in-destroy-3 { global i set i [interp create] $i eval { package req nx nx::Object create ::o { - :public method destroy {} { + :public object method destroy {} { catch {::rename [current] ""} msg next return $msg @@ -504,7 +504,7 @@ # see NsfProcAliasMethod(): # Tcl_Command_cmdEpoch(tcd->aliasedCmd) # -nx::Test case hidden-procs-as-aliases { +nx::test case hidden-procs-as-aliases { # # 1) hide alias proc targets # @@ -514,7 +514,7 @@ package req nx ::proc ::FOO args {return OK} nx::Object create o { - :public alias foo ::FOO + :public object alias foo ::FOO } } @@ -581,7 +581,7 @@ } -nx::Test case hidden-objects-as-aliases { +nx::test case hidden-objects-as-aliases { # # 2) hide alias object targets # @@ -590,10 +590,10 @@ $i eval { package req nx nx::Object create x { - :public method foo {} {return OK} + :public object method foo {} {return OK} } nx::Object create dongo { - :public alias bar ::x + :public object alias bar ::x } } @@ -647,20 +647,20 @@ # MixinSearchProc() # -nx::Test case hidden-mixins-procsearch { +nx::test case hidden-mixins-procsearch { global i set i [interp create] $i eval { package req nx nx::Object create x { - :public method foo {} {return OK} + :public object method foo {} {return OK} } nx::Class create M { :public method foo {} { return <[current class]>[next]<[current class]> } } - x mixin M + x object mixin M } ? {$i eval {x foo}} <::M>OK<::M> @@ -692,7 +692,7 @@ $i hide MM M $i eval {nx::Class create ::M2} - ? {$i eval {x mixin add M2}} {mixin: expected a class as mixin but got "::M"} + ? {$i eval {x object mixin add M2}} {mixin: expected a class as mixin but got "::M"} ? {$i invokehidden M mixin add M2} {expected object but got "::M" for parameter "object"} interp delete $i @@ -703,7 +703,7 @@ # MixinComputeOrderFullList() & friends (due to # CmdListRemoveDeleted() # -nx::Test case hidden-mixins-mixinlists { +nx::test case hidden-mixins-mixinlists { global i set i [interp create] $i eval { @@ -712,11 +712,11 @@ nx::Class create M1 nx::Class create M2 nx::Class create M3 - o mixin {M1 M2} + o object mixin {M1 M2} } ? {$i eval {o info precedence}} "::M1 ::M2 ::nx::Object" - ? {$i eval {o info mixin classes}} {::M1 ::M2} + ? {$i eval {o info object mixin classes}} {::M1 ::M2} ? {$i hidden} "" $i hide M1 ? {$i hidden} M1 @@ -733,11 +733,22 @@ # $i eval {::M2 destroy} ? {$i eval {o info precedence}} "::M1 ::nx::Object" - ? {$i eval {o info mixin classes}} "::M1" + ? {$i eval {o info object mixin classes}} "::M1" ? {$i invokehidden M1 info mixinof} "::o" interp delete $i unset i } +nx::test case nsf-interp-basics { + global i + set i [::nsf::interp create] + ? {$i eval {info commands ::nsf::is}} "::nsf::is" + ? {interp issafe $i} 0 + ? {::nsf::interp create zzz} "zzz" + set i [::nsf::interp create -safe] + ? {$i eval {info commands ::nsf::is}} "::nsf::is" + ? {interp issafe $i} 1 +} +