diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-04-28 10:10:09 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-04-28 10:33:38 +1000 |
commit | bda1bd90a560b5dafb39e0823899d157c6d91e0d (patch) | |
tree | 323ae5c850244e8e6c7972f49e8a28230d1c1482 /tests | |
parent | 043feb14589f317623e2b7316f2c934000029b43 (diff) | |
download | jimtcl-bda1bd90a560b5dafb39e0823899d157c6d91e0d.zip jimtcl-bda1bd90a560b5dafb39e0823899d157c6d91e0d.tar.gz jimtcl-bda1bd90a560b5dafb39e0823899d157c6d91e0d.tar.bz2 |
tests: namespace.test
More namespace tests from Evan Hunter
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/namespace.test | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/namespace.test b/tests/namespace.test index 6c36672..eca28de 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -139,6 +139,24 @@ test namespace-1.28 {namespace variable with array element syntax} -body { } } -returnCodes error -result {can't define "x(3)": name refers to an element in an array} + +test namespace-1.29 {namespace variable too many args} -body { + namespace eval ns1 { + variable x(3) y a b c + } +} -returnCodes error -result {wrong # args: should be "variable name ?value?"} + +test namespace-1.30 {namespace current too many args} -body { + namespace current a +} -returnCodes error -result {wrong # args: should be "namespace current"} + +# TODO: Add tests for canonical option + +test namespace-1.31 {namespace canonical too many args} -body { + namespace canonical a b c +} -returnCodes error -result {wrong # args: should be "namespace canonical ?current? ?name?"} + + unset -nocomplain ns1::x ns1::y # ----------------------------------------------------------------------- @@ -287,6 +305,13 @@ test namespace-5.21 {querying namespace parent for explicit namespace} { [namespace parent nsh1::nsh2::nsh3a] } {{} :: ::nsh1 ::nsh1::nsh2} +test namespace-5.22 {query namespace parent with fully qualified names} { + list [namespace eval :: {namespace parent}] \ + [namespace eval ::nsh1 {namespace parent}] \ + [namespace eval ::nsh1::nsh2 {namespace parent}] \ + [namespace eval nsh1::nsh2::nsh3a {namespace parent ::nsh1::nsh2}] \ +} {{} :: ::nsh1 ::nsh1} + # ----------------------------------------------------------------------- # TEST: name resolution and caching # ----------------------------------------------------------------------- |