Index: tests/varresolutiontest.xotcl =================================================================== diff -u -r782b1f820f03b0f09c3e333a5e03f9ad2808fcac -ra8184b70f4ea9da58c1571356b9b910745a6d5d6 --- tests/varresolutiontest.xotcl (.../varresolutiontest.xotcl) (revision 782b1f820f03b0f09c3e333a5e03f9ad2808fcac) +++ tests/varresolutiontest.xotcl (.../varresolutiontest.xotcl) (revision a8184b70f4ea9da58c1571356b9b910745a6d5d6) @@ -1,6 +1,6 @@ # testing var resolution for namespace-shadowed objects -package require XOTcl; xotcl::use xotcl2 +package require next; namespace import ::nx::* package require xotcl::test Test parameter count 1 @@ -117,6 +117,29 @@ foreach v {::x ::z ::g} {unset -nocomplain $v} ########################################### +# var exists tests +########################################### +Test case exists { + set y 1 + + Object create o {set :x 1} + o method foo {} {info exists :x} + o method bar {} {info exists :y} + ? {o eval {info exists :x}} 1 + ? {o eval {info exists :y}} 0 + ? {o eval {info exists x}} 0 + ? {o foo} 1 + ? {o bar} 0 + ? {::nx::var exists o x} 1 + ? {::nx::var exists o y} 0 + ? {::nx::var exists o :x} {variable name ":x" must not contain namespace separator or colon prefix} + ? {::nx::var exists o :y} {variable name ":y" must not contain namespace separator or colon prefix} + ? {::nx::var set o y 2} 2 + ? {::nx::var exists o y} 1 + ? {::nx::var set o :y 2} {variable name ":y" must not contain namespace separator or colon prefix} +} + +########################################### # mix & match namespace and object interfaces ########################################### Test case namespaces