Lines Matching refs:namespace

3 # support for namespaces.  Other namespace-related tests appear in
15 if {"::tcltest" ni [namespace children]} {
17 namespace import -force ::tcltest::*
25 # REMARK: the tests for 'namespace upvar' are not done here. They are to be
30 catch {namespace delete {*}[namespace children :: test_ns_*]}
34 set current [uplevel 1 {namespace current}]
38 test namespace-1.1 {TclInitNamespaces, GetNamespaceFromObj, NamespaceChildrenCmd} {
39 namespace children :: test_ns_*
43 test namespace-2.1 {Tcl_GetCurrentNamespace} {
44 list [namespace current] [namespace eval {} {namespace current}] \
45 [namespace eval {} {namespace current}]
47 test namespace-2.2 {Tcl_GetCurrentNamespace} {
49 lappend l [namespace current]
50 namespace eval test_ns_1 {
51 lappend l [namespace current]
52 namespace eval foo {
53 lappend l [namespace current]
56 lappend l [namespace current]
59 test namespace-3.1 {Tcl_GetGlobalNamespace} {
60 namespace eval test_ns_1 {namespace eval foo {namespace eval bar {} } }
61 # namespace children uses Tcl_GetGlobalNamespace
62 namespace eval test_ns_1 {namespace children foo b*}
65 test namespace-4.1 {Tcl_PushCallFrame with isProcCallFrame=1} {
66 namespace eval test_ns_1 {
73 test_ns_1::p ;# does Tcl_PushCallFrame to push p's namespace
75 test namespace-4.2 {Tcl_PushCallFrame with isProcCallFrame=0} {
76 namespace eval test_ns_1::baz {} ;# does Tcl_PushCallFrame to create baz
84 test namespace-5.1 {Tcl_PopCallFrame, no vars} {
85 namespace eval test_ns_1::blodge {} ;# pushes then pops frame
87 test namespace-5.2 {Tcl_PopCallFrame, local vars must be deleted} -setup {
88 namespace eval test_ns_1 {}
96 test namespace-6.1 {Tcl_CreateNamespace} {
97 catch {namespace delete {*}[namespace children :: test_ns_*]}
98 list [lsort [namespace children :: test_ns_*]] \
99 [namespace eval test_ns_1 {namespace current}] \
100 [namespace eval test_ns_2 {namespace current}] \
101 [namespace eval ::test_ns_3 {namespace current}] \
102 [namespace eval ::test_ns_4 \
103 {namespace eval foo {namespace current}}] \
104 [namespace eval ::test_ns_5 \
105 {namespace eval ::test_ns_6 {namespace current}}] \
106 [lsort [namespace children :: test_ns_*]]
108 test namespace-6.2 {Tcl_CreateNamespace, odd number of :'s in name is okay} {
109 list [namespace eval :::test_ns_1::::foo {namespace current}] \
110 [namespace eval test_ns_2:::::foo {namespace current}]
112 test namespace-6.3 {Tcl_CreateNamespace, trailing ::s in ns name are ignored} {
113 list [catch {namespace eval test_ns_7::: {namespace current}} msg] $msg
115 test namespace-6.4 {Tcl_CreateNamespace, trailing ::s in ns name are ignored} {
116 catch {namespace delete {*}[namespace children :: test_ns_*]}
117 namespace eval test_ns_1:: {
118 namespace eval test_ns_2:: {}
119 namespace eval test_ns_3:: {}
121 lsort [namespace children ::test_ns_1]
123 test namespace-6.5 {Tcl_CreateNamespace, relative ns names now only looked up in current ns} {
125 namespace eval test_ns_2 {namespace current}
128 lappend l [namespace eval test_ns_1 $trigger]
129 namespace eval test_ns_1::test_ns_2 {}
130 lappend l [namespace eval test_ns_1 $trigger]
133 test namespace-7.1 {Tcl_DeleteNamespace, active call frames in ns} {
134 catch {namespace delete {*}[namespace children :: test_ns_*]}
135 namespace eval test_ns_1 {
137 namespace delete [namespace current]
138 return [namespace current]
143 test namespace-7.2 {Tcl_DeleteNamespace, no active call frames in ns} {
144 namespace eval test_ns_2 {
146 return [namespace current]
149 list [test_ns_2::p] [namespace delete test_ns_2]
151 test namespace-7.3 {recursive Tcl_DeleteNamespace, active call frames in ns} {
153 namespace eval test_ns_2 {
155 trace add variable x unset "namespace delete [namespace current];#"
156 namespace delete [namespace current]
159 test namespace-7.4 {recursive Tcl_DeleteNamespace, active call frames in ns} {
161 namespace eval test_ns_2 {
163 trace add command x delete "namespace delete [namespace current];#"
164 namespace delete [namespace current]
167 test namespace-7.5 {recursive Tcl_DeleteNamespace, no active call frames in ns} {
169 namespace eval test_ns_2 {
171 trace add variable x unset "namespace delete [namespace current];#"
173 namespace delete test_ns_2
175 test namespace-7.6 {recursive Tcl_DeleteNamespace, no active call frames in ns} {
177 namespace eval test_ns_2 {
179 trace add command x delete "namespace delete [namespace current];#"
181 namespace delete test_ns_2
183 test namespace-7.7 {Bug 1655305} -setup {
185 # Can't invoke through the ensemble, since deleting the global namespace
191 namespace delete ::
201 test namespace-7.8 {Bug ba1419303b4c} -setup {
202 namespace eval ns1 {
203 namespace ensemble create
207 namespace delete ns1
211 namespace delete ns1
214 test namespace-8.1 {TclTeardownNamespace, delete global namespace} {
218 namespace eval test_ns_1 {
219 namespace export p
221 return [namespace current]
224 namespace eval test_ns_2 {
225 namespace import ::test_ns_1::p
236 [interp eval test_interp {namespace delete ::}] \
240 test namespace-8.2 {TclTeardownNamespace, remove deleted ns from parent} {
241 catch {namespace delete {*}[namespace children :: test_ns_*]}
242 namespace eval test_ns_1::test_ns_2::test_ns_3a {proc p {} {}}
243 namespace eval test_ns_1::test_ns_2::test_ns_3b {proc q {} {}}
244 list [namespace children test_ns_1] \
245 [namespace delete test_ns_1::test_ns_2] \
246 [namespace children test_ns_1]
248 test namespace-8.3 {TclTeardownNamespace, delete child namespaces} {
249 catch {namespace delete {*}[namespace children :: test_ns_*]}
250 namespace eval test_ns_1::test_ns_2::test_ns_3a {proc p {} {}}
251 namespace eval test_ns_1::test_ns_2::test_ns_3b {proc q {} {}}
252 list [namespace children test_ns_1] \
253 [namespace delete test_ns_1::test_ns_2] \
254 [namespace children test_ns_1] \
255 [catch {namespace children test_ns_1::test_ns_2} msg] $msg \
257 } {::test_ns_1::test_ns_2 {} {} 1 {namespace "test_ns_1::test_ns_2" not found in "::"} {}}
258 test namespace-8.4 {TclTeardownNamespace, cmds imported from deleted ns go away} {
259 catch {namespace delete {*}[namespace children :: test_ns_*]}
260 namespace eval test_ns_export {
261 namespace export cmd1 cmd2
265 namespace eval test_ns_import {
266 namespace import ::test_ns_export::*
270 [namespace delete test_ns_export] \
273 test namespace-8.5 {TclTeardownNamespace: preserve errorInfo; errorCode values} {
275 child eval {trace add execution error leave {namespace delete :: ;#}}
282 test namespace-8.6 {TclTeardownNamespace: preserve errorInfo; errorCode values} {
284 child eval {trace add variable errorCode write {namespace delete :: ;#}}
291 test namespace-8.7 {TclTeardownNamespace: preserve errorInfo; errorCode values} {
293 child eval {trace add execution error leave {namespace delete :: ;#}}
299 test namespace-9.1 {Tcl_Import, empty import pattern} {
300 catch {namespace delete {*}[namespace children :: test_ns_*]}
301 list [catch {namespace eval test_ns_import {namespace import {}}} msg] $msg
303 test namespace-9.2 {Tcl_Import, unknown namespace in import pattern} {
304 list [catch {namespace eval test_ns_import {namespace import fred::x}} msg] $msg
305 } {1 {unknown namespace in import pattern "fred::x"}}
306 test namespace-9.3 {Tcl_Import, import ns == export ns} {
307 list [catch {namespace eval test_ns_import {namespace import ::test_ns_import::puts}} msg] $msg
308 } {1 {import pattern "::test_ns_import::puts" tries to import from namespace "test_ns_import" into …
309 test namespace-9.4 {Tcl_Import, simple import} {
310 catch {namespace delete {*}[namespace children :: test_ns_*]}
311 namespace eval test_ns_export {
312 namespace export cmd1
316 namespace eval test_ns_import {
317 namespace import ::test_ns_export::*
322 test namespace-9.5 {Tcl_Import, RFE 1230597} -setup {
323 namespace eval test_ns_import {}
324 namespace eval test_ns_export {}
326 list [catch {namespace eval test_ns_import {namespace import ::test_ns_export::*}} msg] $msg
328 test namespace-9.6 {Tcl_Import, cmd redefinition ok if allowOverwrite!=0} -setup {
329 namespace eval test_ns_import {}
330 namespace eval ::test_ns_export {
332 namespace export cmd1
335 namespace eval test_ns_import {
336 namespace import -force ::test_ns_export::*
340 test namespace-9.7 {Tcl_Import, links are preserved if cmd is redefined} {
341 catch {namespace delete {*}[namespace children :: test_ns_*]}
342 namespace eval test_ns_export {
343 namespace export cmd1
346 namespace eval test_ns_import {
347 namespace import -force ::test_ns_export::*
352 [namespace origin test_ns_import::cmd1] \
353 [namespace origin test_ns_export::cmd1] \
357 test namespace-9.8 {Tcl_Import: Bug 1017299} -setup {
358 namespace eval one {
359 namespace export cmd
362 namespace eval two {
363 namespace export cmd
366 namespace eval two \
367 [list namespace import [namespace current]::one::cmd]
368 namespace eval three \
369 [list namespace import [namespace current]::two::cmd]
370 namespace eval three {
372 namespace export other
375 namespace eval two [list namespace import -force \
376 [namespace current]::three::other]
377 namespace origin two::other
379 namespace delete one two three
381 test namespace-9.9 {Tcl_Import: Bug 1017299} -setup {
382 namespace eval one {
383 namespace export cmd
386 namespace eval two namespace export cmd
387 namespace eval two \
388 [list namespace import [namespace current]::one::cmd]
389 namespace eval three namespace export cmd
390 namespace eval three \
391 [list namespace import [namespace current]::two::cmd]
393 namespace eval two [list namespace import -force \
394 [namespace current]::three::cmd]
395 namespace origin two::cmd
397 namespace delete one two three
400 test namespace-10.1 {Tcl_ForgetImport, check for valid namespaces} {
401 catch {namespace delete {*}[namespace children :: test_ns_*]}
402 list [catch {namespace forget xyzzy::*} msg] $msg
403 } {1 {unknown namespace in namespace forget pattern "xyzzy::*"}}
404 test namespace-10.2 {Tcl_ForgetImport, ignores patterns that don't match} {
405 namespace eval test_ns_export {
406 namespace export cmd1
410 namespace eval test_ns_import {
411 namespace forget ::test_ns_export::wombat
414 test namespace-10.3 {Tcl_ForgetImport, deletes matching imported cmds} -setup {
415 namespace eval test_ns_export {
416 namespace export cmd1
421 namespace eval test_ns_import {
422 namespace import ::test_ns_export::*
426 namespace forget ::test_ns_export::cmd1
431 test namespace-10.4 {Tcl_ForgetImport: Bug 560297} -setup {
432 namespace eval origin {
433 namespace export cmd
436 namespace eval unrelated {
439 namespace eval my \
440 [list namespace import [namespace current]::origin::cmd]
442 namespace eval my \
443 [list namespace forget [namespace current]::unrelated::cmd]
446 namespace delete origin unrelated my
448 test namespace-10.5 {Tcl_ForgetImport: Bug 560297} -setup {
449 namespace eval origin {
450 namespace export cmd
453 namespace eval my \
454 [list namespace import [namespace current]::origin::cmd]
455 namespace eval my rename cmd newname
457 namespace eval my \
458 [list namespace forget [namespace current]::origin::cmd]
461 namespace delete origin my
463 test namespace-10.6 {Tcl_ForgetImport: Bug 560297} -setup {
464 namespace eval origin {
465 namespace export cmd
468 namespace eval my \
469 [list namespace import [namespace current]::origin::cmd]
470 namespace eval your {}
471 namespace eval my \
472 [list rename cmd [namespace current]::your::newname]
474 namespace eval your namespace forget newname
477 namespace delete origin my your
479 test namespace-10.7 {Tcl_ForgetImport: Bug 560297} -setup {
480 namespace eval origin {
481 namespace export cmd
484 namespace eval link namespace export cmd
485 namespace eval link \
486 [list namespace import [namespace current]::origin::cmd]
487 namespace eval link2 namespace export cmd
488 namespace eval link2 \
489 [list namespace import [namespace current]::link::cmd]
490 namespace eval my \
491 [list namespace import [namespace current]::link2::cmd]
493 namespace eval my \
494 [list namespace forget [namespace current]::origin::cmd]
497 namespace delete origin link link2 my
499 test namespace-10.8 {Tcl_ForgetImport: Bug 560297} -setup {
500 namespace eval origin {
501 namespace export cmd
504 namespace eval link namespace export cmd
505 namespace eval link \
506 [list namespace import [namespace current]::origin::cmd]
507 namespace eval link2 namespace export cmd
508 namespace eval link2 \
509 [list namespace import [namespace current]::link::cmd]
510 namespace eval my \
511 [list namespace import [namespace current]::link2::cmd]
513 namespace eval my \
514 [list namespace forget [namespace current]::link::cmd]
517 namespace delete origin link link2 my
519 test namespace-10.9 {Tcl_ForgetImport: Bug 560297} -setup {
520 namespace eval origin {
521 namespace export cmd
524 namespace eval link namespace export cmd
525 namespace eval link \
526 [list namespace import [namespace current]::origin::cmd]
527 namespace eval link2 namespace export cmd
528 namespace eval link2 \
529 [list namespace import [namespace current]::link::cmd]
530 namespace eval my \
531 [list namespace import [namespace current]::link2::cmd]
533 namespace eval my \
534 [list namespace forget [namespace current]::link2::cmd]
537 namespace delete origin link link2 my
540 test namespace-11.1 {TclGetOriginalCommand, check if not imported cmd} -setup {
541 catch {namespace delete {*}[namespace children :: test_ns_*]}
543 namespace eval test_ns_export {
544 namespace export cmd1
547 list [namespace origin set] [namespace origin test_ns_export::cmd1]
549 test namespace-11.2 {TclGetOriginalCommand, directly imported cmd} -setup {
550 catch {namespace delete {*}[namespace children :: test_ns_*]}
551 namespace eval test_ns_export {
552 namespace export cmd1
556 namespace eval test_ns_import1 {
557 namespace import ::test_ns_export::*
558 namespace export *
559 proc p {} {namespace origin cmd1}
561 list [test_ns_import1::p] [namespace origin test_ns_import1::cmd1]
563 test namespace-11.3 {TclGetOriginalCommand, indirectly imported cmd} -setup {
564 catch {namespace delete {*}[namespace children :: test_ns_*]}
565 namespace eval test_ns_export {
566 namespace export cmd1
569 namespace eval test_ns_import1 {
570 namespace import ::test_ns_export::*
571 namespace export *
572 proc p {} {namespace origin cmd1}
575 namespace eval test_ns_import2 {
576 namespace import ::test_ns_import1::*
579 list [test_ns_import2::q] [namespace origin test_ns_import2::cmd1]
582 test namespace-12.1 {InvokeImportedCmd} {
583 catch {namespace delete {*}[namespace children :: test_ns_*]}
584 namespace eval test_ns_export {
585 namespace export cmd1
586 proc cmd1 {args} {namespace current}
588 namespace eval test_ns_import {
589 namespace import ::test_ns_export::*
594 test namespace-13.1 {DeleteImportedCmd, deletes imported cmds} -setup {
595 catch {namespace delete {*}[namespace children :: test_ns_*]}
596 namespace eval test_ns_export {
597 namespace export cmd1
598 proc cmd1 {args} {namespace current}
600 namespace eval test_ns_import {
601 namespace import ::test_ns_export::*
604 namespace eval test_ns_import {
607 namespace forget ::test_ns_export::cmd1
611 test namespace-13.2 {DeleteImportedCmd, Bug a4494e28ed} {
613 namespace eval src {namespace export foo; proc foo {} {}}
614 namespace eval dst {namespace import [namespace parent]::src::foo}
616 "[list namespace delete [namespace current]::dst] ;#"
618 namespace delete src
621 test namespace-14.1 {TclGetNamespaceForQualName, absolute names} -setup {
622 catch {namespace delete {*}[namespace children :: test_ns_*]}
624 namespace eval test_ns_1::test_ns_2 {
627 namespace eval test_ns_2 {
631 namespace eval test_ns_1 {
633 [lsort [namespace children :: test_ns_*]]
636 test namespace-14.2 {TclGetNamespaceForQualName, invalid absolute names} -setup {
637 catch {namespace delete {*}[namespace children :: test_ns_*]}
639 namespace eval test_ns_1::test_ns_2 {
642 namespace eval test_ns_2 {
646 namespace eval test_ns_1 {
648 [catch {namespace children test_ns_777} msg] $msg
650 } -result {1 {can't read "::test_ns_777::v": no such variable} 1 {namespace "test_ns_777" not found…
651 test namespace-14.3 {TclGetNamespaceForQualName, relative names} -setup {
652 catch {namespace delete {*}[namespace children :: test_ns_*]}
654 namespace eval test_ns_1::test_ns_2 {
657 namespace eval test_ns_2 {
661 namespace eval test_ns_1 {
665 test namespace-14.4 {TclGetNamespaceForQualName, relative ns names looked up only in current ns} {
666 namespace eval test_ns_1::test_ns_2 {
667 namespace eval foo {}
669 namespace eval test_ns_1 {
670 list [namespace children test_ns_2] \
671 [catch {namespace children test_ns_1} msg] $msg
673 } {::test_ns_1::test_ns_2::foo 1 {namespace "test_ns_1" not found in "::test_ns_1"}}
674 test namespace-14.5 {TclGetNamespaceForQualName, relative ns names looked up only in current ns} {
675 namespace eval ::test_ns_2 {
676 namespace eval bar {}
678 namespace eval test_ns_1 {
679 list [catch {namespace delete test_ns_2::bar} msg] $msg
681 } {1 {unknown namespace "test_ns_2::bar" in namespace delete command}}
682 test namespace-14.6 {TclGetNamespaceForQualName, relative ns names looked up only in current ns} {
683 namespace eval test_ns_1::test_ns_2 {
684 namespace eval foo {}
686 namespace eval test_ns_1 {
687 list [namespace children test_ns_2] \
688 [catch {namespace children test_ns_1} msg] $msg
690 } {::test_ns_1::test_ns_2::foo 1 {namespace "test_ns_1" not found in "::test_ns_1"}}
691 test namespace-14.7 {TclGetNamespaceForQualName, ignore extra :s if ns} -setup {
692 namespace eval test_ns_1::test_ns_2::foo {}
694 namespace children test_ns_1:::
696 test namespace-14.8 {TclGetNamespaceForQualName, ignore extra :s if ns} -setup {
697 namespace eval test_ns_1::test_ns_2::foo {}
699 namespace children :::test_ns_1:::::test_ns_2:::
701 test namespace-14.9 {TclGetNamespaceForQualName, extra ::s are significant for vars} {
704 namespace eval test_ns_1::test_ns_2 {variable {} 2525}
707 test namespace-14.10 {TclGetNamespaceForQualName, extra ::s are significant for vars} -setup {
708 namespace eval test_ns_1::test_ns_2::foo {}
716 test namespace-14.11 {TclGetNamespaceForQualName, extra ::s are significant for commands} -setup {
717 namespace eval test_ns_1::test_ns_2::foo {}
725 test namespace-14.12 {TclGetNamespaceForQualName, extra ::s are significant for vars} -setup {
726 catch {namespace delete {*}[namespace children :: test_ns_*]}
728 namespace eval test_ns_1 {
734 test namespace-14.13 {TclGetNamespaceForQualName, namespace other than global ns can't have empty n…
735 catch {namespace delete {*}[namespace children :: test_ns_*]}
737 namespace eval test_ns_1 {
739 namespace eval {} {}
742 } -result {can't create namespace "": only global namespace can have empty name}
744 test namespace-15.1 {Tcl_FindNamespace, absolute name found} -setup {
745 catch {namespace delete {*}[namespace children :: test_ns_*]}
747 namespace eval test_ns_delete {
748 namespace eval test_ns_delete2 {}
749 proc cmd {args} {namespace current}
751 list [namespace delete ::test_ns_delete::test_ns_delete2] \
752 [namespace children ::test_ns_delete]
754 test namespace-15.2 {Tcl_FindNamespace, absolute name not found} -body {
755 namespace delete ::test_ns_delete::test_ns_delete2
756 } -returnCodes error -result {unknown namespace "::test_ns_delete::test_ns_delete2" in namespace de…
757 test namespace-15.3 {Tcl_FindNamespace, relative name found} {
758 namespace eval test_ns_delete {
759 namespace eval test_ns_delete2 {}
760 namespace eval test_ns_delete3 {}
761 list [namespace delete test_ns_delete2] \
762 [namespace children [namespace current]]
765 test namespace-15.4 {Tcl_FindNamespace, relative name not found} {
766 namespace eval test_ns_delete2 {}
767 namespace eval test_ns_delete {
768 list [catch {namespace delete test_ns_delete2} msg] $msg
770 } {1 {unknown namespace "test_ns_delete2" in namespace delete command}}
772 test namespace-16.1 {Tcl_FindCommand, absolute name found} -setup {
773 catch {namespace delete {*}[namespace children :: test_ns_*]}
775 namespace eval test_ns_1 {
776 proc cmd {args} {return "[namespace current]::cmd: $args"}
781 test namespace-16.2 {Tcl_FindCommand, absolute name found} -setup {
782 catch {namespace delete {*}[namespace children :: test_ns_*]}
783 namespace eval test_ns_1 {
784 proc cmd {args} {return "[namespace current]::cmd: $args"}
790 test namespace-16.3 {Tcl_FindCommand, absolute name not found} {
791 namespace eval test_ns_1 {
802 test namespace-16.4 {Tcl_FindCommand, absolute name and TCL_GLOBAL_ONLY} {
805 test namespace-16.5 {Tcl_FindCommand, absolute name and TCL_GLOBAL_ONLY} {
808 test namespace-16.6 {Tcl_FindCommand, relative name and TCL_GLOBAL_ONLY} {
811 test namespace-16.7 {Tcl_FindCommand, relative name and TCL_GLOBAL_ONLY} {
818 test namespace-16.8 {Tcl_FindCommand, relative name found} -setup {
819 catch {namespace delete {*}[namespace children :: test_ns_*]}
820 namespace eval test_ns_1 {
821 proc cmd {args} {return "[namespace current]::cmd: $args"}
824 namespace eval test_ns_1 {
828 test namespace-16.9 {Tcl_FindCommand, relative name found} -body {
829 proc cmd2 {args} {return "[namespace current]::cmd2: $args"}
830 namespace eval test_ns_1 {
836 test namespace-16.10 {Tcl_FindCommand, relative name found, only look in current then global ns} -b…
837 proc cmd2 {args} {return "[namespace current]::cmd2: $args"}
838 namespace eval test_ns_1 {
840 return "[namespace current]::cmd2 in test_ns_1: $args"
842 namespace eval test_ns_12 {
849 test namespace-16.11 {Tcl_FindCommand, relative name not found} -body {
850 namespace eval test_ns_1 {
856 test namespace-17.1 {Tcl_FindNamespaceVar, absolute name found} -setup {
857 catch {namespace delete {*}[namespace children :: test_ns_*]}
860 namespace eval test_ns_1 {
865 test namespace-17.2 {Tcl_FindNamespaceVar, absolute name found} {
866 namespace eval test_ns_1 {
871 test namespace-17.3 {Tcl_FindNamespaceVar, absolute name found} {
872 namespace eval test_ns_1 {
873 namespace eval test_ns_2 {
879 test namespace-17.4 {Tcl_FindNamespaceVar, absolute name not found} -body {
880 namespace eval test_ns_1 {
881 namespace eval test_ns_2 {
887 test namespace-17.5 {Tcl_FindNamespaceVar, absolute name and TCL_GLOBAL_ONLY} -setup {
888 namespace eval ::test_ns_1::test_ns_2 {}
890 namespace eval test_ns_1 {
891 namespace eval test_ns_3 {
897 test namespace-17.6 {Tcl_FindNamespaceVar, relative name found} -setup {
898 namespace eval test_ns_1 {
902 namespace eval test_ns_1 {
906 test namespace-17.7 {Tcl_FindNamespaceVar, relative name found} {
907 namespace eval test_ns_1 {
913 test namespace-17.8 {Tcl_FindNamespaceVar, relative name not found} -body {
914 namespace eval test_ns_1 {
918 test namespace-17.9 {Tcl_FindNamespaceVar, relative name and TCL_GLOBAL_ONLY} {
919 namespace eval test_ns_1 {
924 test namespace-17.10 {Tcl_FindNamespaceVar, interference with cached varNames} -setup {
925 namespace eval test_ns_1 {}
932 namespace eval test_ns_1 unset a
934 namespace eval test_ns_1 set a 1
935 namespace delete test_ns_1
943 test namespace-18.1 {TclResetShadowedCmdRefs, one-level check for command shadowing} -setup {
944 catch {namespace delete {*}[namespace children :: test_ns_*]}
947 namespace eval test_ns_1 {
954 namespace eval test_ns_1 {
960 test namespace-18.2 {TclResetShadowedCmdRefs, multilevel check for command shadowing} {
961 namespace eval test_ns_2 {
964 namespace eval test_ns_1 {
965 namespace eval test_ns_2 {}
972 namespace eval test_ns_1 {
973 namespace eval test_ns_2 {
983 test namespace-19.1 {GetNamespaceFromObj, global name found} -setup {
984 catch {namespace delete {*}[namespace children :: test_ns_*]}
986 namespace eval test_ns_1::test_ns_2 {}
987 namespace children ::test_ns_1
989 test namespace-19.2 {GetNamespaceFromObj, relative name found} -setup {
990 catch {namespace delete {*}[namespace children :: test_ns_*]}
991 namespace eval test_ns_1::test_ns_2 {}
993 namespace eval test_ns_1 {
994 namespace children test_ns_2
997 test namespace-19.3 {GetNamespaceFromObj, name not found} -setup {
998 catch {namespace delete {*}[namespace children :: test_ns_*]}
1000 namespace eval test_ns_1 {
1001 namespace children test_ns_99
1003 } -returnCodes error -result {namespace "test_ns_99" not found in "::test_ns_1"}
1004 test namespace-19.4 {GetNamespaceFromObj, invalidation of cached ns refs} -setup {
1005 catch {namespace delete {*}[namespace children :: test_ns_*]}
1006 namespace eval test_ns_1::test_ns_2 {}
1008 namespace eval test_ns_1 {
1010 return [namespace children test_ns_2]
1012 list [catch {namespace children test_ns_99} msg] $msg
1016 namespace delete test_ns_1::test_ns_2
1017 namespace eval test_ns_1::test_ns_2::test_ns_3 {}
1021 test namespace-20.1 {Tcl_NamespaceObjCmd, bad subcommand} {
1022 catch {namespace delete {*}[namespace children :: test_ns_*]}
1023 list [catch {namespace} msg] $msg
1024 } {1 {wrong # args: should be "namespace subcommand ?arg ...?"}}
1025 test namespace-20.2 {Tcl_NamespaceObjCmd, bad subcommand} -body {
1026 namespace wombat {}
1028 test namespace-20.3 {Tcl_NamespaceObjCmd, abbreviations are okay} {
1029 namespace ch :: test_ns_*
1032 test namespace-21.1 {NamespaceChildrenCmd, no args} -setup {
1033 catch {namespace delete {*}[namespace children :: test_ns_*]}
1035 namespace eval test_ns_1::test_ns_2 {}
1036 expr {"::test_ns_1" in [namespace children]}
1038 test namespace-21.2 {NamespaceChildrenCmd, no args} -setup {
1039 catch {namespace delete {*}[namespace children :: test_ns_*]}
1040 namespace eval test_ns_1::test_ns_2 {}
1042 namespace eval test_ns_1 {
1043 namespace children
1046 test namespace-21.3 {NamespaceChildrenCmd, ns name given} -setup {
1047 catch {namespace delete {*}[namespace children :: test_ns_*]}
1048 namespace eval test_ns_1::test_ns_2 {}
1050 namespace children ::test_ns_1
1052 test namespace-21.4 {NamespaceChildrenCmd, ns name given} -setup {
1053 catch {namespace delete {*}[namespace children :: test_ns_*]}
1054 namespace eval test_ns_1::test_ns_2 {}
1056 namespace eval test_ns_1 {
1057 namespace children test_ns_2
1060 test namespace-21.5 {NamespaceChildrenCmd, too many args} {
1061 namespace eval test_ns_1 {
1062 list [catch {namespace children test_ns_2 xxx yyy} msg] $msg
1064 } {1 {wrong # args: should be "namespace children ?name? ?pattern?"}}
1065 test namespace-21.6 {NamespaceChildrenCmd, glob-style pattern given} {
1066 namespace eval test_ns_1::test_ns_foo {}
1067 namespace children test_ns_1 *f*
1069 test namespace-21.7 {NamespaceChildrenCmd, glob-style pattern given} -setup {
1070 catch {namespace delete {*}[namespace children :: test_ns_*]}
1071 namespace eval test_ns_1::test_ns_2 {}
1073 namespace eval test_ns_1::test_ns_foo {}
1074 lsort [namespace children test_ns_1 test*]
1076 test namespace-21.8 {NamespaceChildrenCmd, trivial pattern starting with ::} {
1077 namespace eval test_ns_1 {}
1078 namespace children [namespace current] [fq test_ns_1]
1081 test namespace-22.1 {NamespaceCodeCmd, bad args} {
1082 catch {namespace delete {*}[namespace children :: test_ns_*]}
1083 list [catch {namespace code} msg] $msg \
1084 [catch {namespace code xxx yyy} msg] $msg
1085 } {1 {wrong # args: should be "namespace code arg"} 1 {wrong # args: should be "namespace code arg"…
1086 test namespace-22.2 {NamespaceCodeCmd, arg is already scoped value} {
1087 namespace eval test_ns_1 {
1090 namespace code {::namespace inscope ::test_ns_1 cmd}
1091 } {::namespace inscope ::test_ns_1 cmd}
1092 test namespace-22.3 {NamespaceCodeCmd, arg is already scoped value} {
1093 namespace code {namespace inscope ::test_ns_1 cmd}
1094 } {::namespace inscope :: {namespace inscope ::test_ns_1 cmd}}
1095 test namespace-22.4 {NamespaceCodeCmd, in :: namespace} {
1096 namespace code unknown
1097 } {::namespace inscope :: unknown}
1098 test namespace-22.5 {NamespaceCodeCmd, in other namespace} {
1099 namespace eval test_ns_1 {
1100 namespace code cmd
1102 } {::namespace inscope ::test_ns_1 cmd}
1103 test namespace-22.6 {NamespaceCodeCmd, in other namespace} {
1104 namespace eval test_ns_1 {
1107 namespace eval test_ns_2 {
1108 proc namespace args {}
1110 namespace eval test_ns_2 [namespace eval test_ns_1 {
1111 namespace code {set v}
1114 test namespace-22.7 {NamespaceCodeCmd, Bug 3202171} {
1115 namespace eval demo {
1116 proc namespace args {puts $args}
1117 ::namespace code {namespace inscope foo}
1119 } [list ::namespace inscope [fq demo] {namespace inscope foo}]
1121 test namespace-23.1 {NamespaceCurrentCmd, bad args} {
1122 catch {namespace delete {*}[namespace children :: test_ns_*]}
1123 list [catch {namespace current xxx} msg] $msg \
1124 [catch {namespace current xxx yyy} msg] $msg
1125 } {1 {wrong # args: should be "namespace current"} 1 {wrong # args: should be "namespace current"}}
1126 test namespace-23.2 {NamespaceCurrentCmd, at global level} {
1127 namespace current
1129 test namespace-23.3 {NamespaceCurrentCmd, in nested ns} {
1130 namespace eval test_ns_1::test_ns_2 {
1131 namespace current
1135 test namespace-24.1 {NamespaceDeleteCmd, no args} {
1136 catch {namespace delete {*}[namespace children :: test_ns_*]}
1137 namespace delete
1139 test namespace-24.2 {NamespaceDeleteCmd, one arg} {
1140 namespace eval test_ns_1::test_ns_2 {}
1141 namespace delete ::test_ns_1
1143 test namespace-24.3 {NamespaceDeleteCmd, two args} {
1144 namespace eval test_ns_1::test_ns_2 {}
1145 list [namespace delete ::test_ns_1::test_ns_2] [namespace delete ::test_ns_1]
1147 test namespace-24.4 {NamespaceDeleteCmd, unknown ns} {
1148 list [catch {namespace delete ::test_ns_foo} msg] $msg
1149 } {1 {unknown namespace "::test_ns_foo" in namespace delete command}}
1151 test namespace-25.1 {NamespaceEvalCmd, bad args} {
1152 catch {namespace delete {*}[namespace children :: test_ns_*]}
1153 list [catch {namespace eval} msg] $msg
1154 } {1 {wrong # args: should be "namespace eval name arg ?arg...?"}}
1155 test namespace-25.2 {NamespaceEvalCmd, bad args} -body {
1156 namespace test_ns_1
1159 test namespace-25.3 {NamespaceEvalCmd, new namespace} {
1161 namespace eval test_ns_1 {
1170 test namespace-25.4 {NamespaceEvalCmd, existing namespace} -setup {
1171 namespace eval test_ns_1 {
1179 namespace eval test_ns_1 {
1184 test namespace-25.5 {NamespaceEvalCmd, multiple args} -setup {
1185 namespace eval test_ns_1 {variable v 314159}
1187 namespace eval test_ns_1 "set" "v"
1189 test namespace-25.6 {NamespaceEvalCmd, error in eval'd script} {
1190 list [catch {namespace eval test_ns_1 {xxxx}} msg] $msg $::errorInfo
1194 (in namespace eval "::test_ns_1" script line 1)
1196 "namespace eval test_ns_1 {xxxx}"}}
1197 test namespace-25.7 {NamespaceEvalCmd, error in eval'd script} {
1198 list [catch {namespace eval test_ns_1 {error foo bar baz}} msg] $msg $::errorInfo
1200 (in namespace eval "::test_ns_1" script line 1)
1202 "namespace eval test_ns_1 {error foo bar baz}"}}
1203 test namespace-25.8 {NamespaceEvalCmd, error in eval'd script} {
1204 list [catch {namespace eval test_ns_1 error foo bar baz} msg] $msg $::errorInfo
1206 (in namespace eval "::test_ns_1" script line 1)
1208 "namespace eval test_ns_1 error foo bar baz"}}
1210 test namespace-25.9 {NamespaceEvalCmd, 545325} {
1211 namespace eval test_ns_1 info level 0
1212 } {namespace eval test_ns_1 info level 0}
1214 test namespace-26.1 {NamespaceExportCmd, no args and new ns} {
1215 catch {namespace delete {*}[namespace children :: test_ns_*]}
1216 namespace export
1218 test namespace-26.2 {NamespaceExportCmd, just -clear arg} {
1219 namespace export -clear
1221 test namespace-26.3 {NamespaceExportCmd, pattern can't specify a namespace} {
1222 namespace eval test_ns_1 {
1223 list [catch {namespace export ::zzz} msg] $msg
1225 } {1 {invalid export pattern "::zzz": pattern can't specify a namespace}}
1226 test namespace-26.4 {NamespaceExportCmd, one pattern} {
1227 namespace eval test_ns_1 {
1228 namespace export cmd1
1234 namespace eval test_ns_2 {
1235 namespace import ::test_ns_1::*
1239 test namespace-26.5 {NamespaceExportCmd, sequence of patterns, patterns accumulate} -setup {
1240 catch {namespace delete {*}[namespace children test_ns_*]}
1241 namespace eval test_ns_1 {
1246 namespace export cmd1 cmd3
1249 namespace eval test_ns_2 {
1250 namespace import -force ::test_ns_1::*
1254 test namespace-26.6 {NamespaceExportCmd, no patterns means return uniq'ed export list} -setup {
1255 catch {namespace delete {*}[namespace children test_ns_*]}
1256 namespace eval test_ns_1 {
1261 namespace export cmd1 cmd3
1264 namespace eval test_ns_1 {
1265 namespace export
1268 test namespace-26.7 {NamespaceExportCmd, -clear resets export list} -setup {
1269 catch {namespace delete {*}[namespace children test_ns_*]}
1270 namespace eval test_ns_1 {
1277 namespace eval test_ns_1 {
1278 namespace export cmd1 cmd3
1280 namespace eval test_ns_2 {
1281 namespace import ::test_ns_1::*
1283 namespace eval test_ns_1 {
1284 namespace export -clear cmd4
1286 namespace eval test_ns_2 {
1287 namespace import ::test_ns_1::*
1291 test namespace-26.8 {NamespaceExportCmd, -clear resets export list} {
1292 catch {namespace delete foo}
1293 namespace eval foo {
1294 namespace export x
1295 namespace export -clear
1297 list [namespace eval foo namespace export] [namespace delete foo]
1300 test namespace-27.1 {NamespaceForgetCmd, no args} {
1301 catch {namespace delete {*}[namespace children :: test_ns_*]}
1302 namespace forget
1304 test namespace-27.2 {NamespaceForgetCmd, args must be valid namespaces} {
1305 list [catch {namespace forget ::test_ns_1::xxx} msg] $msg
1306 } {1 {unknown namespace in namespace forget pattern "::test_ns_1::xxx"}}
1307 test namespace-27.3 {NamespaceForgetCmd, arg is forgotten} {
1308 namespace eval test_ns_1 {
1309 namespace export cmd*
1313 namespace eval test_ns_2 {
1314 namespace import ::test_ns_1::*
1315 namespace forget ::test_ns_1::cmd1
1320 test namespace-28.1 {NamespaceImportCmd, no args} -setup {
1321 catch {namespace delete {*}[namespace children :: test_ns_*]}
1323 namespace eval ::test_ns_1 {
1328 namespace export foo b*
1330 namespace eval ::test_ns_2 {
1331 namespace import ::test_ns_1::*
1332 lsort [namespace import]
1335 catch {namespace delete {*}[namespace children :: test_ns_*]}
1337 test namespace-28.2 {NamespaceImportCmd, no args and just "-force"} {
1338 namespace import -force
1340 test namespace-28.3 {NamespaceImportCmd, arg is imported} {
1341 namespace eval test_ns_1 {
1342 namespace export cmd2
1346 namespace eval test_ns_2 {
1347 namespace import ::test_ns_1::*
1348 namespace forget ::test_ns_1::cmd1
1353 test namespace-29.1 {NamespaceInscopeCmd, bad args} {
1354 catch {namespace delete {*}[namespace children :: test_ns_*]}
1355 list [catch {namespace inscope} msg] $msg
1356 } {1 {wrong # args: should be "namespace inscope name arg ?arg...?"}}
1357 test namespace-29.2 {NamespaceInscopeCmd, bad args} {
1358 list [catch {namespace inscope ::} msg] $msg
1359 } {1 {wrong # args: should be "namespace inscope name arg ?arg...?"}}
1360 test namespace-29.3 {NamespaceInscopeCmd, specified ns must exist} -body {
1361 namespace inscope test_ns_1 {set v}
1362 } -returnCodes error -result {namespace "test_ns_1" not found in "::"}
1363 test namespace-29.4 {NamespaceInscopeCmd, simple case} {
1364 namespace eval test_ns_1 {
1368 return "[namespace current]::cmd: v=$v, args=$args"
1371 namespace inscope test_ns_1 cmd
1373 test namespace-29.5 {NamespaceInscopeCmd, has lappend semantics} -setup {
1374 namespace eval test_ns_1 {
1378 return "[namespace current]::cmd: v=$v, args=$args"
1382 list [namespace inscope test_ns_1 cmd x y z] \
1383 [namespace eval test_ns_1 [concat cmd [list x y z]]]
1385 test namespace-29.6 {NamespaceInscopeCmd, 1400572} -setup {
1386 namespace eval test_ns_1 {}
1388 namespace inscope test_ns_1 {info level 0}
1389 } -result {namespace inscope test_ns_1 {info level 0}}
1391 test namespace-30.1 {NamespaceOriginCmd, bad args} {
1392 catch {namespace delete {*}[namespace children :: test_ns_*]}
1393 list [catch {namespace origin} msg] $msg
1394 } {1 {wrong # args: should be "namespace origin name"}}
1395 test namespace-30.2 {NamespaceOriginCmd, bad args} {
1396 list [catch {namespace origin x y} msg] $msg
1397 } {1 {wrong # args: should be "namespace origin name"}}
1398 test namespace-30.3 {NamespaceOriginCmd, command not found} {
1399 list [catch {namespace origin fred} msg] $msg
1401 test namespace-30.4 {NamespaceOriginCmd, command isn't imported} {
1402 namespace origin set
1404 test namespace-30.5 {NamespaceOriginCmd, imported command} {
1405 namespace eval test_ns_1 {
1406 namespace export cmd*
1410 namespace eval test_ns_2 {
1411 namespace export *
1412 namespace import ::test_ns_1::*
1415 namespace eval test_ns_3 {
1416 namespace import ::test_ns_2::*
1417 list [namespace origin foreach] \
1418 [namespace origin p] \
1419 [namespace origin cmd1] \
1420 [namespace origin ::test_ns_2::cmd2]
1424 test namespace-31.1 {NamespaceParentCmd, bad args} {
1425 catch {namespace delete {*}[namespace children :: test_ns_*]}
1426 list [catch {namespace parent a b} msg] $msg
1427 } {1 {wrong # args: should be "namespace parent ?name?"}}
1428 test namespace-31.2 {NamespaceParentCmd, no args} {
1429 namespace parent
1431 test namespace-31.3 {NamespaceParentCmd, namespace specified} {
1432 namespace eval test_ns_1 {
1433 namespace eval test_ns_2 {
1434 namespace eval test_ns_3 {}
1437 list [namespace parent ::] \
1438 [namespace parent test_ns_1::test_ns_2] \
1439 [namespace eval test_ns_1::test_ns_2::test_ns_3 {namespace parent ::test_ns_1::test_ns_2}]
1441 test namespace-31.4 {NamespaceParentCmd, bad namespace specified} -body {
1442 namespace parent test_ns_1::test_ns_foo
1443 } -returnCodes error -result {namespace "test_ns_1::test_ns_foo" not found in "::"}
1445 test namespace-32.1 {NamespaceQualifiersCmd, bad args} {
1446 catch {namespace delete {*}[namespace children :: test_ns_*]}
1447 list [catch {namespace qualifiers} msg] $msg
1448 } {1 {wrong # args: should be "namespace qualifiers string"}}
1449 test namespace-32.2 {NamespaceQualifiersCmd, bad args} {
1450 list [catch {namespace qualifiers x y} msg] $msg
1451 } {1 {wrong # args: should be "namespace qualifiers string"}}
1452 test namespace-32.3 {NamespaceQualifiersCmd, simple name} {
1453 namespace qualifiers foo
1455 test namespace-32.4 {NamespaceQualifiersCmd, leading ::} {
1456 namespace qualifiers ::x::y::z
1458 test namespace-32.5 {NamespaceQualifiersCmd, no leading ::} {
1459 namespace qualifiers a::b
1461 test namespace-32.6 {NamespaceQualifiersCmd, :: argument} {
1462 namespace qualifiers ::
1464 test namespace-32.7 {NamespaceQualifiersCmd, odd number of :s} {
1465 namespace qualifiers :::::
1467 test namespace-32.8 {NamespaceQualifiersCmd, odd number of :s} {
1468 namespace qualifiers foo:::
1471 test namespace-33.1 {NamespaceTailCmd, bad args} {
1472 catch {namespace delete {*}[namespace children :: test_ns_*]}
1473 list [catch {namespace tail} msg] $msg
1474 } {1 {wrong # args: should be "namespace tail string"}}
1475 test namespace-33.2 {NamespaceTailCmd, bad args} {
1476 list [catch {namespace tail x y} msg] $msg
1477 } {1 {wrong # args: should be "namespace tail string"}}
1478 test namespace-33.3 {NamespaceTailCmd, simple name} {
1479 namespace tail foo
1481 test namespace-33.4 {NamespaceTailCmd, leading ::} {
1482 namespace tail ::x::y::z
1484 test namespace-33.5 {NamespaceTailCmd, no leading ::} {
1485 namespace tail a::b
1487 test namespace-33.6 {NamespaceTailCmd, :: argument} {
1488 namespace tail ::
1490 test namespace-33.7 {NamespaceTailCmd, odd number of :s} {
1491 namespace tail :::::
1493 test namespace-33.8 {NamespaceTailCmd, odd number of :s} {
1494 namespace tail foo:::
1497 test namespace-34.1 {NamespaceWhichCmd, bad args} {
1498 catch {namespace delete {*}[namespace children :: test_ns_*]}
1499 list [catch {namespace which} msg] $msg
1500 } {1 {wrong # args: should be "namespace which ?-command? ?-variable? name"}}
1501 test namespace-34.2 {NamespaceWhichCmd, bad args} {
1502 list [catch {namespace which -fred x} msg] $msg
1503 } {1 {wrong # args: should be "namespace which ?-command? ?-variable? name"}}
1504 test namespace-34.3 {NamespaceWhichCmd, single arg is always command name} {
1505 namespace which -command
1507 test namespace-34.4 {NamespaceWhichCmd, bad args} {
1508 list [catch {namespace which a b} msg] $msg
1509 } {1 {wrong # args: should be "namespace which ?-command? ?-variable? name"}}
1510 test namespace-34.5 {NamespaceWhichCmd, command lookup} -setup {
1511 catch {namespace delete {*}[namespace children test_ns_*]}
1512 namespace eval test_ns_1 {
1513 namespace export cmd*
1518 namespace eval test_ns_2 {
1519 namespace export *
1520 namespace import ::test_ns_1::*
1525 namespace eval test_ns_3 {
1526 namespace import ::test_ns_2::*
1528 list [namespace which -command foreach] \
1529 [namespace which -command p] \
1530 [namespace which -command cmd1] \
1531 [namespace which -command ::test_ns_2::cmd2] \
1532 [catch {namespace which -command ::test_ns_2::noSuchCmd} msg] $msg
1535 test namespace-34.6 {NamespaceWhichCmd, -command is default} -setup {
1536 catch {namespace delete {*}[namespace children test_ns_*]}
1537 namespace eval test_ns_1 {
1538 namespace export cmd*
1542 namespace eval test_ns_2 {
1543 namespace export *
1544 namespace import ::test_ns_1::*
1547 namespace eval test_ns_3 {
1548 namespace import ::test_ns_2::*
1551 namespace eval test_ns_3 {
1552 list [namespace which foreach] \
1553 [namespace which p] \
1554 [namespace which cmd1] \
1555 [namespace which ::test_ns_2::cmd2]
1558 test namespace-34.7 {NamespaceWhichCmd, variable lookup} -setup {
1559 catch {namespace delete {*}[namespace children test_ns_*]}
1560 namespace eval test_ns_1 {
1561 namespace export cmd*
1565 namespace eval test_ns_2 {
1566 namespace export *
1567 namespace import ::test_ns_1::*
1571 namespace eval test_ns_3 {
1573 namespace import ::test_ns_2::*
1576 namespace eval test_ns_3 {
1577 list [namespace which -variable env] \
1578 [namespace which -variable v3] \
1579 [namespace which -variable ::test_ns_2::v2] \
1580 [catch {namespace which -variable ::test_ns_2::noSuchVar} msg] $msg
1584 test namespace-35.1 {FreeNsNameInternalRep, resulting ref count > 0} -setup {
1585 catch {namespace delete {*}[namespace children :: test_ns_*]}
1587 namespace eval test_ns_1 {
1589 namespace delete [namespace current]
1590 return [namespace current]
1595 test namespace-35.2 {FreeNsNameInternalRep, resulting ref count == 0} {
1596 namespace eval test_ns_1 {
1598 return [namespace current]
1602 [namespace delete test_ns_1] \
1608 test namespace-36.1 {DupNsNameInternalRep} {
1609 catch {namespace delete {*}[namespace children :: test_ns_*]}
1610 namespace eval test_ns_1 {}
1612 list [namespace parent $x] [set y $x] [namespace parent $y]
1617 test namespace-37.1 {SetNsNameFromAny, ns name found} {
1618 catch {namespace delete {*}[namespace children :: test_ns_*]}
1619 namespace eval test_ns_1::test_ns_2 {}
1620 namespace eval test_ns_1 {
1621 namespace children ::test_ns_1
1624 test namespace-37.2 {SetNsNameFromAny, ns name not found} -body {
1625 namespace eval test_ns_1 {
1626 namespace children ::test_ns_1::test_ns_foo
1628 } -returnCodes error -result {namespace "::test_ns_1::test_ns_foo" not found}
1630 test namespace-38.1 {UpdateStringOfNsName} {
1631 catch {namespace delete {*}[namespace children :: test_ns_*]}
1633 list [namespace eval {} {namespace current}] \
1634 [namespace eval {} {namespace current}]
1637 test namespace-39.1 {NamespaceExistsCmd} {
1638 catch {namespace delete {*}[namespace children :: test_ns_*]}
1639 namespace eval ::test_ns_z::test_me { variable foo }
1640 list [namespace exists ::] \
1641 [namespace exists ::bogus_namespace] \
1642 [namespace exists ::test_ns_z] \
1643 [namespace exists test_ns_z] \
1644 [namespace exists ::test_ns_z::foo] \
1645 [namespace exists ::test_ns_z::test_me] \
1646 [namespace eval ::test_ns_z { namespace exists ::test_me }] \
1647 [namespace eval ::test_ns_z { namespace exists test_me }] \
1648 [namespace exists :::::test_ns_z]
1650 test namespace-39.2 {NamespaceExistsCmd error} {
1651 list [catch {namespace exists} msg] $msg
1652 } {1 {wrong # args: should be "namespace exists name"}}
1653 test namespace-39.3 {NamespaceExistsCmd error} {
1654 list [catch {namespace exists a b} msg] $msg
1655 } {1 {wrong # args: should be "namespace exists name"}}
1657 test namespace-40.1 {Ignoring namespace proc "unknown"} -setup {
1661 namespace eval ns {proc unknown args {return local}}
1662 list [namespace eval ns aaa bbb] [namespace eval ns aaa]
1666 namespace delete ns
1669 test namespace-41.1 {Shadowing byte-compiled commands, Bug: 231259} {
1671 namespace eval ns {
1682 namespace delete ns
1685 test namespace-41.2 {Shadowing byte-compiled commands, Bug: 231259} {
1687 namespace eval ns {}
1695 namespace delete ns
1698 test namespace-41.3 {Shadowing byte-compiled commands, Bugs: 231259, 729692} {
1700 namespace eval ns {
1709 namespace delete ns
1715 test namespace-42.1 {ensembles: basic} {
1716 namespace eval ns {
1717 namespace export x
1719 namespace ensemble create
1721 list [info command ns] [ns x] [namespace delete ns] [info command ns]
1723 test namespace-42.2 {ensembles: basic} {
1724 namespace eval ns {
1725 namespace export x
1727 namespace ensemble create
1730 list [info command foo] [foo x] [namespace delete ns] [info command foo]
1732 test namespace-42.3 {ensembles: basic} {
1733 namespace eval ns {
1734 namespace export x*
1737 namespace ensemble create
1743 namespace delete ns
1746 test namespace-42.4 {ensembles: basic} -body {
1747 namespace eval ns {
1748 namespace export y*
1751 namespace ensemble create
1755 namespace delete ns
1756 } -result {1 {unknown subcommand "x": namespace ::ns does not export any commands}}
1757 test namespace-42.5 {ensembles: basic} -body {
1758 namespace eval ns {
1759 namespace export x*
1763 namespace ensemble create
1767 namespace delete ns
1769 test namespace-42.6 {ensembles: nested} -body {
1770 namespace eval ns {
1771 namespace export x*
1772 namespace eval x0 {
1774 namespace export z
1775 namespace ensemble create
1780 namespace ensemble create
1784 namespace delete ns
1786 test namespace-42.7 {ensembles: nested} -body {
1787 namespace eval ns {
1788 namespace export x*
1789 namespace eval x0 {
1791 namespace export z
1792 namespace ensemble create
1797 namespace ensemble create
1801 namespace delete ns
1803 test namespace-42.8 {
1808 variable target [list [namespace which demo] x]
1810 trace add execution demo enter [namespace code trial]
1811 namespace ensemble create -command foo -map [list bar $target]
1821 test namespace-42.9 {
1825 namespace eval n {namespace ensemble create}
1827 namespace ensemble configure n -subcommands $lst -map $lst
1831 namespace delete n
1835 test namespace-42.10 {
1839 namespace eval n {namespace ensemble create}
1841 namespace ensemble configure n -subcommands $lst -map $lst
1845 namespace delete n
1850 test namespace-42.11 {
1855 namespace eval n1 {
1856 namespace ensemble create
1857 namespace export *
1862 set cmd {namespace eva n1 {[namespace parent]::n1 p1}}
1867 test namespace-43.1 {ensembles: dict-driven} {
1868 namespace eval ns {
1869 namespace export x*
1872 namespace ensemble create -map {a x1 b x2}
1874 set result [list [catch {ns c} msg] $msg [namespace ensemble exists ns]]
1876 lappend result [namespace ensemble exists ns]
1878 test namespace-43.2 {ensembles: dict-driven} -body {
1879 namespace eval ns {
1880 namespace export x*
1883 namespace ensemble create -map {
1889 namespace delete ns
1892 namespace eval ns {
1893 namespace export a b
1898 namespace ensemble create -subcommands {b c}
1901 test namespace-43.3 {ensembles: list-driven} -setup $SETUP -body {
1902 namespace delete ns
1904 test namespace-43.4 {ensembles: list-driven} -setup $SETUP -body {
1906 } -cleanup {namespace delete ns} -returnCodes error -result {unknown or ambiguous subcommand "a": m…
1907 test namespace-43.5 {ensembles: list-driven} -setup $SETUP -body {
1909 } -cleanup {namespace delete ns} -result 2,5
1910 test namespace-43.6 {ensembles: list-driven} -setup $SETUP -body {
1912 } -cleanup {namespace delete ns} -result 3,5
1913 test namespace-43.7 {ensembles: list-driven} -setup $SETUP -body {
1915 } -cleanup {namespace delete ns} -returnCodes error -result {unknown or ambiguous subcommand "d": m…
1917 namespace eval ns {
1918 namespace export a b
1923 namespace ensemble create -subcommands {b c} -map {c ::ns::d}
1926 test namespace-43.8 {ensembles: list-and-map-driven} -setup $SETUP -body {
1927 namespace delete ns
1929 test namespace-43.9 {ensembles: list-and-map-driven} -setup $SETUP -body {
1931 } -cleanup {namespace delete ns} -returnCodes error -result {unknown or ambiguous subcommand "a": m…
1932 test namespace-43.10 {ensembles: list-and-map-driven} -setup $SETUP -body {
1934 } -cleanup {namespace delete ns} -result 2,5
1935 test namespace-43.11 {ensembles: list-and-map-driven} -setup $SETUP -body {
1937 } -cleanup {namespace delete ns} -result 4,5
1938 test namespace-43.12 {ensembles: list-and-map-driven} -setup $SETUP -body {
1940 } -cleanup {namespace delete ns} -returnCodes error -result {unknown or ambiguous subcommand "d": m…
1942 namespace eval ns {
1943 namespace export *
1946 namespace ensemble create -prefixes off
1949 test namespace-43.13 {ensembles: turn off prefixes} -setup $SETUP -body {
1950 namespace delete ns
1952 test namespace-43.14 {ensembles: turn off prefixes} -setup $SETUP -body {
1954 } -cleanup {namespace delete ns} -returnCodes error -result {unknown subcommand "fo": must be foo, …
1955 test namespace-43.15 {ensembles: turn off prefixes} -setup $SETUP -body {
1957 } -cleanup {namespace delete ns} -result bar
1958 test namespace-43.16 {ensembles: turn off prefixes} -setup $SETUP -body {
1960 } -cleanup {namespace delete ns} -returnCodes error -result {unknown subcommand "s": must be foo, o…
1961 test namespace-43.17 {ensembles: turn off prefixes} -setup $SETUP -body {
1963 } -cleanup {namespace delete ns} -result wibble
1965 test namespace-44.1 {ensemble: errors} {
1966 list [catch {namespace ensemble} msg] $msg
1967 } {1 {wrong # args: should be "namespace ensemble subcommand ?arg ...?"}}
1968 test namespace-44.2 {ensemble: errors} {
1969 list [catch {namespace ensemble ?} msg] $msg
1971 test namespace-44.3 {ensemble: errors} {
1972 namespace eval ns {
1973 list [catch {namespace ensemble create -map x} msg] $msg
1976 test namespace-44.4 {ensemble: errors} {
1977 namespace eval ns {
1978 list [catch {namespace ensemble create -map {x {}}} msg] $msg
1981 test namespace-44.5 {ensemble: errors} -setup {
1982 namespace ensemble create -command foobar -subcommands {foobarcget foobarconfigure}
1988 test namespace-44.6 {ensemble: errors} -returnCodes error -body {
1989 namespace ensemble create gorp
1990 } -result {wrong # args: should be "namespace ensemble create ?option value ...?"}
1992 test namespace-45.1 {ensemble: introspection} {
1993 namespace eval ns {
1994 namespace export x
1996 namespace ensemble create
1997 set ::result [namespace ensemble configure ::ns]
1999 namespace delete ns
2001 } {-map {} -namespace ::ns -parameters {} -prefixes 1 -subcommands {} -unknown {}}
2002 test namespace-45.2 {ensemble: introspection} {
2003 namespace eval ns {
2004 namespace export x
2006 namespace ensemble create -map {A x}
2007 set ::result [namespace ensemble configure ::ns -map]
2009 namespace delete ns
2013 test namespace-46.1 {ensemble: modification} {
2014 namespace eval ns {
2015 namespace export x
2018 namespace ensemble create -command ns -map {A ::ns::x}
2019 set ::result [list [namespace ensemble configure ns -map] [ns A]]
2021 namespace ensemble configure ns -map {B ::ns::x}
2022 lappend ::result [namespace ensemble configure ns -map] [ns B]
2024 namespace ensemble configure ns -map {}
2025 lappend ::result [namespace ensemble configure ns -map] [ns x]
2027 namespace delete ns
2030 test namespace-46.2 {ensemble: ensembles really use current export list} {
2031 namespace eval ns {
2032 namespace export x1
2035 namespace ensemble create
2038 namespace eval ns {namespace export x*}
2042 namespace delete ns
2045 test namespace-46.3 {ensemble: implementation errors} {
2046 namespace eval ns {
2048 namespace ensemble create -map {
2060 namespace delete ns
2063 test namespace-46.4 {ensemble: implementation errors} {
2064 namespace eval ns {
2065 namespace ensemble create
2069 namespace delete ns
2071 } {ns 1 {unknown subcommand "?": namespace ::ns does not export any commands}}
2072 test namespace-46.5 {ensemble: implementation errors} {
2073 namespace eval ns {
2074 namespace ensemble create -map {makeError ::error}
2076 list [catch {ns makeError "an error happened"} msg] $msg $::errorInfo [namespace delete ns]
2080 test namespace-46.6 {ensemble: implementation renames/deletes itself} {
2081 namespace eval ns {
2082 namespace ensemble create -map {to ::rename}
2088 namespace delete ns
2090 test namespace-46.7 {ensemble: implementation deletes its namespace} {
2091 namespace eval ns {
2092 namespace ensemble create -map {kill {::namespace delete}}
2096 test namespace-46.8 {ensemble: implementation deletes its namespace} {
2097 namespace eval ns {
2098 namespace export *
2106 namespace delete [namespace current]
2108 namespace ensemble create
2112 test namespace-46.9 {ensemble: configuring really configures things} {
2113 namespace eval ns {
2114 namespace ensemble create -map {a a} -prefixes 0
2117 namespace ensemble configure ns -map {b b}
2119 namespace delete ns
2123 test namespace-47.1 {ensemble: unknown handler} {
2125 namespace eval ns {
2126 namespace export {[a-z]*}
2142 namespace ensemble create -unknown ::ns::Magic
2150 list $result [lsort [info commands ::ns::*]] $log [namespace delete ns]
2152 test namespace-47.2 {ensemble: unknown handler} {
2153 namespace eval ns {
2154 namespace export {[a-z]*}
2158 namespace ensemble create -unknown ::ns::Magic
2160 list [catch {ns spong} msg] $msg $::errorInfo [namespace delete ns]
2170 test namespace-47.3 {ensemble: unknown handler} {
2171 namespace eval ns {
2173 namespace export {[a-z]*}
2181 namespace ensemble create -unknown ::ns::Magic
2183 list [catch {ns spong} msg] $msg $ns::count [namespace delete ns]
2185 test namespace-47.4 {ensemble: unknown handler} {
2186 namespace eval ns {
2187 namespace export {[a-z]*}
2191 namespace ensemble create -unknown ::ns::Magic
2193 list [catch {ns spong} msg] $msg $::errorInfo [namespace delete ns]
2198 test namespace-47.5 {ensemble: unknown handler} {
2199 namespace ensemble create -command foo -unknown bar
2209 lappend result [catch {foo bar} msg] $msg [namespace ensemble config foo]
2212namespace :: does not export any commands} {LOG ::foo bar} boo hoo 0 {{LOG ::foo bar} 1 {unknown s…
2213 test namespace-47.6 {ensemble: unknown handler} {
2214 namespace ensemble create -command foo -unknown bar
2225 test namespace-47.7 {ensemble: unknown handler, commands with spaces} {
2226 namespace ensemble create -command foo -unknown bar
2234 test namespace-47.8 {ensemble: unknown handler, commands with spaces} {
2235 namespace ensemble create -command foo -unknown {bar boo}
2244 test namespace-48.1 {ensembles and namespace import: unknown handler} {
2245 namespace eval foo {
2246 namespace export bar
2247 namespace ensemble create -command bar -unknown ::foo::u -subcomm x
2251 namespace ensemble config $ens -subcommand {x y}
2256 namespace ensemble config ::bar -subcommand {x y z}
2271 namespace import -force foo::bar
2272 set result [list [namespace ensemble config bar]]
2275 namespace ensemble config bar -unknown ::foo::u2
2277 namespace delete foo
2279 } {{-map {} -namespace ::foo -parameters {} -prefixes 1 -subcommands x -unknown ::foo::u} XXX 123 :…
2280 test namespace-48.2 {ensembles and namespace import: exists} {
2281 namespace eval foo {
2282 namespace ensemble create -command ::foo::bar
2283 namespace export bar
2285 set result [namespace ensemble exist foo::bar]
2286 lappend result [namespace ensemble exist bar]
2287 namespace import foo::bar
2288 lappend result [namespace ensemble exist bar]
2290 lappend result [namespace ensemble exist bar] \
2291 [namespace ensemble exist spong]
2293 lappend result [namespace ensemble exist bar] \
2294 [namespace ensemble exist spong]
2296 lappend result [namespace ensemble exist spong]
2297 namespace delete foo
2300 test namespace-48.3 {ensembles and namespace import: config} {
2302 namespace eval foo {
2303 namespace ensemble create -command ::foo::bar
2304 namespace export bar boo
2307 namespace import foo::bar foo::boo
2308 set result [namespace ensemble config bar -namespace]
2309 lappend result [catch {namespace ensemble config boo} msg] $msg
2310 lappend result [catch {namespace ensemble config spong} msg] $msg
2311 namespace delete foo
2315 test namespace-49.1 {ensemble subcommand caching} -body {
2316 namespace ens cre -command a -map {b {lappend result 1}}
2317 namespace ens cre -command c -map {b {lappend result 2}}
2325 test namespace-49.2 {strange delete crash} -body {
2326 namespace eval foo {namespace ensemble create -command ::bar}
2332 namespace delete foo
2339 test namespace-50.1 {ensembles affect proc arguments error messages} -body {
2340 namespace ens cre -command a -map {b {bb foo}}
2347 test namespace-50.2 {ensembles affect WrongNumArgs error messages} -body {
2348 namespace ens cre -command a -map {b {string is}}
2353 test namespace-50.3 {chained ensembles affect error messages} -body {
2354 namespace ens cre -command a -map {b c}
2355 namespace ens cre -command c -map {d e}
2362 test namespace-50.4 {chained ensembles affect error messages} -body {
2363 namespace ens cre -command a -map {b {c d}}
2364 namespace ens cre -command c -map {d {e f}}
2371 test namespace-50.5 {[4402cfa58c]} -setup {
2374 namespace ensemble create -command launch -map {foo bar event bingo}
2385 test namespace-50.6 {[4402cfa58c]} -setup {
2387 namespace ensemble create -command e2 -map {s2 target}
2388 namespace ensemble create -command e1 -map {s1 e2}
2401 test namespace-50.7 {[4402cfa58c]} -setup {
2403 namespace ensemble create -command e2 -map {s2 target}
2404 namespace ensemble create -command e1 -map {s1 e2} -parameters foo
2417 test namespace-50.8 {[f961d7d1dd]} -setup {
2419 namespace ensemble create -command e -map {s target} -parameters {{a b}}
2426 test namespace-50.9 {[cea0344a51]} -body {
2427 namespace eval foo {
2428 namespace eval bar {
2429 namespace delete foo
2432 } -returnCodes error -result {unknown namespace "foo" in namespace delete command}
2434 test namespace-51.1 {name resolution path control} -body {
2435 namespace eval ::test_ns_1 {
2436 namespace eval test_ns_2 {
2438 ::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
2450 namespace path ::test_ns_1
2460 namespace delete ::test_ns_1
2464 test namespace-51.2 {name resolution path control} -body {
2465 namespace eval ::test_ns_1 {
2466 namespace eval test_ns_2 {
2467 namespace path ::test_ns_1
2469 ::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
2490 namespace delete ::test_ns_1
2494 test namespace-51.3 {name resolution path control} -body {
2495 namespace eval ::test_ns_1 {
2496 namespace eval test_ns_2 {
2498 ::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
2518 namespace eval ::test_ns_1::test_ns_2 {
2519 namespace path ::test_ns_1
2525 namespace delete ::test_ns_1
2529 test namespace-51.4 {name resolution path control} -body {
2530 namespace eval ::test_ns_1 {
2531 namespace eval test_ns_2 {
2533 ::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
2553 namespace eval ::test_ns_1::test_ns_2 {
2554 namespace path ::test_ns_1
2557 namespace eval ::test_ns_1::test_ns_2 {
2558 namespace path {}
2562 namespace delete ::test_ns_1
2566 test namespace-51.5 {name resolution path control} -body {
2567 namespace eval ::test_ns_1 {
2568 namespace eval test_ns_2 {
2570 ::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
2575 namespace path ::test_ns_1
2594 namespace eval ::test_ns_1::test_ns_2 {
2595 namespace path {:: ::test_ns_1}
2601 namespace delete ::test_ns_1
2605 test namespace-51.6 {name resolution path control} -body {
2606 namespace eval ::test_ns_1 {
2607 namespace eval test_ns_2 {
2609 ::return [pathtestB],[pathtestC],[pathtestD],[namespace path]
2614 namespace path ::test_ns_1
2633 namespace eval ::test_ns_1::test_ns_2 {
2634 namespace path {:: ::test_ns_1}
2644 namespace delete ::test_ns_1
2649 test namespace-51.7 {name resolution path control} -body {
2650 namespace eval ::test_ns_1 {
2652 namespace eval ::test_ns_2 {
2653 namespace path ::test_ns_1
2654 proc getpath {} {namespace path}
2656 list [::test_ns_2::getpath] [namespace delete ::test_ns_1] [::test_ns_2::getpath]
2658 catch {namespace delete ::test_ns_1}
2659 namespace delete ::test_ns_2
2661 test namespace-51.8 {name resolution path control} -body {
2662 namespace eval ::test_ns_1 {
2664 namespace eval ::test_ns_2 {
2666 namespace eval ::test_ns_3 {
2668 namespace eval ::test_ns_4 {
2669 namespace path {::test_ns_1 ::test_ns_2 ::test_ns_3}
2670 proc getpath {} {namespace path}
2672 list [::test_ns_4::getpath] [namespace delete ::test_ns_2] [::test_ns_4::getpath]
2674 catch {namespace delete ::test_ns_1}
2675 catch {namespace delete ::test_ns_2}
2676 catch {namespace delete ::test_ns_3}
2677 catch {namespace delete ::test_ns_4}
2679 test namespace-51.9 {name resolution path control} -body {
2680 namespace eval ::test_ns_1 {
2682 namespace eval ::test_ns_2 {
2684 namespace eval ::test_ns_3 {
2686 namespace eval ::test_ns_4 {
2687 namespace path {::test_ns_1 ::test_ns_2 ::test_ns_3}
2688 proc getpath {} {namespace path}
2690 …list [::test_ns_4::getpath] [namespace delete ::test_ns_2] [namespace eval ::test_ns_2 {}] [::test…
2692 catch {namespace delete ::test_ns_1}
2693 catch {namespace delete ::test_ns_2}
2694 catch {namespace delete ::test_ns_3}
2695 catch {namespace delete ::test_ns_4}
2697 test namespace-51.10 {name resolution path control} -body {
2698 namespace eval ::test_ns_1 {
2699 namespace path does::not::exist
2701 } -returnCodes error -result {namespace "does::not::exist" not found in "::test_ns_1"} -cleanup {
2702 catch {namespace delete ::test_ns_1}
2704 test namespace-51.11 {name resolution path control} -body {
2705 namespace eval ::test_ns_1 {
2708 namespace eval ::test_ns_2 {
2711 namespace eval ::test_ns_3 {
2712 namespace path ::test_ns_1
2714 namespace eval ::test_ns_4 {
2715 namespace path {::test_ns_3 ::test_ns_2}
2719 catch {namespace delete ::test_ns_1}
2720 catch {namespace delete ::test_ns_2}
2721 catch {namespace delete ::test_ns_3}
2722 catch {namespace delete ::test_ns_4}
2724 test namespace-51.12 {name resolution path control} -body {
2725 namespace eval ::test_ns_1 {
2728 namespace eval ::test_ns_2 {
2731 namespace eval ::test_ns_3 {
2732 namespace path ::test_ns_1
2734 namespace eval ::test_ns_4 {
2735 namespace path {::test_ns_3 ::test_ns_2}
2736 list [foo] [namespace delete ::test_ns_3] [foo]
2739 catch {namespace delete ::test_ns_1}
2740 catch {namespace delete ::test_ns_2}
2741 catch {namespace delete ::test_ns_3}
2742 catch {namespace delete ::test_ns_4}
2744 test namespace-51.13 {name resolution path control} -body {
2746 namespace eval ::test_ns_1 {
2749 namespace eval ::test_ns_2 {
2751 trace add command foo delete "namespace eval ::test_ns_3 foo;#"
2753 namespace eval ::test_ns_3 {
2756 namespace delete [namespace current]
2760 namespace eval ::test_ns_4 {
2761 namespace path {::test_ns_2 ::test_ns_3 ::test_ns_1}
2763 list [foo] [namespace delete ::test_ns_2] [foo]
2769 catch {namespace delete ::test_ns_1}
2770 catch {namespace delete ::test_ns_2}
2771 catch {namespace delete ::test_ns_3}
2772 catch {namespace delete ::test_ns_4}
2774 test namespace-51.14 {name resolution path control} -setup {
2778 namespace eval ::test_ns_1 {}
2779 namespace eval ::test_ns_2 {}
2780 namespace eval ::test_ns_3 {}
2785 namespace eval ::test_ns_3 {
2788 namespace path {::test_ns_1 ::test_ns_2}
2794 namespace delete ::test_ns_1
2798 catch {namespace delete ::test_ns_1}
2799 catch {namespace delete ::test_ns_2}
2800 catch {namespace delete ::test_ns_3}
2802 test namespace-51.15 {namespace resolution path control} -body {
2803 namespace eval ::test_ns_2 {
2806 namespace eval ::test_ns_1 {
2807 namespace eval test_ns_2 {
2810 namespace eval test_ns_3 {
2811 namespace path ::test_ns_1
2816 namespace delete ::test_ns_1
2817 namespace delete ::test_ns_2
2819 test namespace-51.16 {Bug 1566526} {
2821 child eval namespace eval demo namespace path ::
2824 test namespace-51.17 {resolution epoch handling: Bug 2898722} -setup {
2826 catch {namespace delete ::a}
2828 namespace eval ::a {
2831 namespace eval b {
2836 namespace eval b {
2837 namespace path [namespace parent]
2841 namespace eval b {
2847 namespace eval ::a::b {
2860 namespace delete ::a
2864 test namespace-51.18 {Bug 3185407} -setup {
2865 namespace eval ::test_ns_1 {}
2867 namespace eval ::test_ns_1 {
2869 namespace eval ns {proc foo {} {}}
2870 namespace eval ns2 {proc foo {} {}}
2871 namespace path {ns ns2}
2873 lappend result [namespace which $x]
2875 lappend result [namespace which $x]
2878 namespace delete ::test_ns_1
2881 # TIP 181 - namespace unknown tests
2882 test namespace-52.1 {unknown: default handler ::unknown} {
2883 set result [list [namespace eval foobar { namespace unknown }]]
2884 lappend result [namespace eval :: { namespace unknown }]
2885 namespace delete foobar
2888 test namespace-52.2 {unknown: default resolution global} {
2890 namespace eval ::bar { proc foo {} { return "NAMESPACE" } }
2891 namespace eval ::bar::jim { proc test {} { foo } }
2893 namespace delete ::bar
2897 test namespace-52.3 {unknown: default resolution local} {
2899 namespace eval ::bar {
2904 namespace delete ::bar
2908 test namespace-52.4 {unknown: set handler} {
2909 namespace eval foo {
2910 namespace unknown [list dispatch]
2917 namespace delete foo
2920 test namespace-52.5 {unknown: search path before unknown is unaltered} {
2922 namespace eval foo {
2923 namespace unknown [list dispatch]
2934 namespace delete foo
2938 test namespace-52.6 {unknown: deleting handler restores default} {
2941 namespace eval foo {
2942 namespace unknown dummy
2943 namespace unknown {}
2945 set result [namespace eval foo { dummy a b c }]
2948 namespace delete foo
2951 test namespace-52.7 {unknown: setting global unknown handler} {
2953 namespace eval :: { namespace unknown ::myunknown }
2954 set result [namespace eval foo { dummy a b c }]
2955 namespace eval :: { namespace unknown {} }
2957 namespace delete foo
2960 test namespace-52.8 {unknown: destroying and redefining global namespace} {
2963 $i hide namespace
2965 $i invokehidden namespace delete ::
2970 test namespace-52.9 {unknown: refcounting} -setup {
2973 set copy [namespace unknown]
2977 set handler [namespace unknown]
2978 namespace unknown {this is a test}
2983 namespace unknown $handler
2987 test namespace-52.10 {unknown: with TCL_EVAL_GLOBAL} -constraints {
2992 set caller [uplevel 1 {namespace current}]
2993 namespace eval $caller {
3000 namespace eval :: {
3003 namespace eval test_ns_1 {
3009 namespace delete test_ns_1
3013 test namespace-52.11 {unknown: with TCL_EVAL_INVOKE} -setup {
3014 set handler [namespace eval :: {namespace unknown}]
3015 namespace eval :: {namespace unknown unknown}
3017 namespace eval :: {
3026 namespace eval test_ns_1 {
3027 namespace unknown unknown
3036 namespace delete test_ns_1
3039 namespace eval :: [list namespace unknown $handler]
3041 test namespace-52.12 {unknown: error case must not reset handler} -body {
3042 namespace eval foo {
3043 namespace unknown ok
3044 catch {namespace unknown {{}{}{}}}
3045 namespace unknown
3048 namespace delete foo
3052 test namespace-53.1 {ensembles: parameters} {
3053 namespace eval ns {
3054 namespace export x
3056 namespace ensemble create -parameters {para1}
3058 list [info command ns] [ns bar x] [namespace delete ns] [info command ns]
3060 test namespace-53.2 {ensembles: parameters} -setup {
3061 namespace eval ns {
3062 namespace export x
3064 namespace ensemble create
3067 namespace ensemble configure ns -parameters {para1}
3069 list [info command foo] [foo bar x] [namespace delete ns] [info command foo]
3071 test namespace-53.3 {ensembles: parameters} -setup {
3072 namespace eval ns {
3073 namespace export x*
3076 namespace ensemble create -parameters param1
3084 namespace delete ns
3091 test namespace-53.4 {ensembles: parameters} -setup {
3092 namespace eval ns {
3093 namespace export x*
3097 namespace ensemble create
3102 namespace ensemble configure ns -parameters p1
3104 namespace ensemble configure ns -parameters {p1 p2}
3107 namespace delete ns
3109 test namespace-53.5 {ensembles: parameters} -setup {
3110 namespace eval ns {
3111 namespace export x*
3115 namespace ensemble create
3120 namespace ensemble configure ns -parameters p1
3124 namespace delete ns
3130 test namespace-53.6 {ensembles: nested} -setup {
3131 namespace eval ns {
3132 namespace export x*
3133 namespace eval x0 {
3135 namespace export z
3136 namespace ensemble create
3141 namespace ensemble create -parameters p
3146 namespace delete ns
3148 test namespace-53.7 {ensembles: parameters & wrong # args} -setup {
3149 namespace eval ns {
3150 namespace export x*
3152 namespace ensemble create -parameters p1
3163 namespace delete ns
3171 test namespace-53.8 {ensemble: unknown handler changing -parameters} -setup {
3172 namespace eval ns {
3173 namespace export x*
3176 namespace ensemble configure $ensemble\
3178 namespace ensemble configure $ensemble -parameters
3182 namespace ensemble create -unknown ::ns::Magic
3186 lappend result [catch {ns x1 x2} msg] $msg [namespace ensemble configure ns -parameters]
3187 lappend result [catch {ns x2 x1} msg] $msg [namespace ensemble configure ns -parameters]
3188 lappend result [catch {ns x2 x3} msg] $msg [namespace ensemble configure ns -parameters]
3190 namespace delete ns
3195 test namespace-53.9 {ensemble: unknown handler changing -parameters,\
3197 namespace eval ns {
3198 namespace export x*
3201 namespace ensemble configure $ensemble\
3205 namespace ensemble create -unknown ::ns::Magic
3209 lappend result [catch {ns x1 x2} msg] $msg [namespace ensemble configure ns -parameters]
3210 lappend result [catch {ns x2 x1} msg] $msg [namespace ensemble configure ns -parameters]
3211 …lappend result [catch {ns a1 a2 a3 a4 a5 x1} msg] $msg [namespace ensemble configure ns -parameter…
3213 namespace delete ns
3218 test namespace-53.10 {ensembles: nested rewrite} -setup {
3219 namespace eval ns {
3220 namespace export x
3221 namespace eval x {
3226 namespace export z*
3227 namespace ensemble create
3229 namespace ensemble create -parameters p
3238 namespace ensemble configure ns::x -parameters q1
3245 namespace delete ns
3255 test namespace-53.11 {ensembles: nested rewrite} -setup {
3256 namespace eval ns {
3257 namespace export x
3258 namespace eval x {
3260 namespace export z*
3261 namespace ensemble create -parameter p
3263 namespace ensemble create
3268 namespace delete ns
3272 test namespace-54.1 {leak on namespace deletion} -constraints {memory} \
3282 namespace eval $ns {}
3283 namespace delete $ns
3293 test namespace-55.1 {compiled ensembles inside compiled ensembles: Bug 6d2f249a01} {
3297 test namespace-56.1 {bug f97d4ee020: mutually-entangled deletion} {
3298 namespace eval ::testing {
3304 namespace delete ::testing
3306 test namespace-56.2 {bug f97d4ee020: mutually-entangled deletion} {
3307 namespace eval ::testing {
3308 namespace eval abc {proc xyz {} {}}
3309 namespace eval def {proc xyz {} {}}
3310 trace add command abc::xyz delete "namespace delete ::testing::def {}; #"
3311 trace add command def::xyz delete "namespace delete ::testing::abc {}; #"
3313 namespace delete ::testing
3315 test namespace-56.3 {bug f97d4ee020: mutually-entangled deletion} {
3316 namespace eval ::testing {
3323 namespace eval abc {
3327 namespace delete abc
3331 namespace delete ::testing
3336 test namespace-56.4 {bug 16fe1b5807: names starting with ":"} knownBug {
3337 namespace eval : {
3338 namespace ensemble create
3339 namespace export *
3348 test namespace-56.5 {Bug 8b9854c3d8} -setup {
3349 namespace eval namespace-56.5 {
3351 namespace export *
3352 namespace ensemble create
3355 namespace-56.5 cmd
3357 namespace delete namespace-56.5
3361 test namespace-56.6 {
3371 namespace eval ns1 {} {
3372 namespace export *
3374 namespace upvar [namespace parent] res res
3380 namespace eval ns2 {} {
3381 namespace import ::ns1::p1
3385 namespace delete ns1
3386 namespace delete ns2
3394 test namespace-57.0 {
3400 namespace eval ns2 {
3401 namespace export *
3406 interp alias {} [namespace current]::p2 {} [namespace which p1]
3410 namespace eval ns3 {
3411 namespace import ::ns2::p2
3421 } [namespace current]]]
3429 namespace delete ns2
3430 namespace delete ns3
3441 namespace delete {*}[namespace children :: test_ns_*]