summaryrefslogtreecommitdiffstats
path: root/tests/namespace.test
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-03-06 19:22:10 (GMT)
committersebres <sebres@users.sourceforge.net>2024-03-06 19:22:10 (GMT)
commitd40afc686f42f1c48ca70817a9ce0501e086f5d3 (patch)
treeb5ba4a3c203f42933f688d27fc3626c1493614a7 /tests/namespace.test
parentcc4f019bcf7e4fafcbacfc3083e03a38d8545e4c (diff)
downloadtcl-d40afc686f42f1c48ca70817a9ce0501e086f5d3.zip
tcl-d40afc686f42f1c48ca70817a9ce0501e086f5d3.tar.gz
tcl-d40afc686f42f1c48ca70817a9ce0501e086f5d3.tar.bz2
better variant of fix for [910d67a229fe7f65] with improved search for NS::command (find NS even if command is not simple name), additionally
it'd invoke handler of parent NS if child NS doesn't have unknown handler (see test namespace-52.14)
Diffstat (limited to 'tests/namespace.test')
-rw-r--r--tests/namespace.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/namespace.test b/tests/namespace.test
index c8c1992..5a8f6f4 100644
--- a/tests/namespace.test
+++ b/tests/namespace.test
@@ -3056,6 +3056,22 @@ test namespace-52.13 {unknown: invocation outside of NS doesn't evade namespace
} -cleanup {
namespace delete ::foo
} -result {{::foo:bar:_unknown ::foo::bar xxx} {::foo:bar:_unknown ::foo bar::xxx} {::foo:bar:_unknown :: ::foo::bar::xxx} {::foo:bar:_unknown :: foo::bar::xxx}}
+test namespace-52.14 {unknown: invocation outside of NS doesn't evade namespace unknown for command with sub-NS, bug 910d67a229fe7f65} -body {
+ namespace eval ::foo::bar {
+ proc _unknown args {list ::foo:bar:_unknown [uplevel {namespace current}] $args}
+ namespace unknown [namespace current]::_unknown
+ }
+ set res {}
+ lappend res [namespace inscope ::foo::bar {xxx::yyy}] [namespace inscope ::foo {bar::xxx::yyy}] [::foo::bar::xxx::yyy] [namespace inscope :: {foo::bar::xxx::yyy}]
+ # now with existsing ::foo::bar::xxx, but without unknown handler inside (only parent ::foo::bar has a handler):
+ namespace eval ::foo::bar::xxx {}
+ lappend res [namespace inscope ::foo::bar {xxx::yyy}] [namespace inscope ::foo {bar::xxx::yyy}] [::foo::bar::xxx::yyy] [namespace inscope :: {foo::bar::xxx::yyy}]
+} -cleanup {
+ namespace delete ::foo
+ unset -nocomplain res
+} -result [lrepeat 2 \
+ {::foo:bar:_unknown ::foo::bar xxx::yyy} {::foo:bar:_unknown ::foo bar::xxx::yyy} {::foo:bar:_unknown :: ::foo::bar::xxx::yyy} {::foo:bar:_unknown :: foo::bar::xxx::yyy}
+]
# TIP 314 - ensembles with parameters
test namespace-53.1 {ensembles: parameters} {