summaryrefslogtreecommitdiffstats
path: root/tests/namespace.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2016-05-21 09:27:30 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2016-05-21 09:27:30 (GMT)
commitca66ff4b66c7c2c37cf104ead999ae2fc8c85747 (patch)
tree41386636fdb87c929e9f9a78888ce2539fa00a3d /tests/namespace.test
parent09ec4a59520b6557298cffe32e679a6733928077 (diff)
parentf74fa93858b232af77de13991c43775c193df25a (diff)
downloadtcl-ca66ff4b66c7c2c37cf104ead999ae2fc8c85747.zip
tcl-ca66ff4b66c7c2c37cf104ead999ae2fc8c85747.tar.gz
tcl-ca66ff4b66c7c2c37cf104ead999ae2fc8c85747.tar.bz2
Fix for [f97d4ee020]; use a two-stage approach to avoid quadratic behavior.
Diffstat (limited to 'tests/namespace.test')
-rw-r--r--tests/namespace.test39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/namespace.test b/tests/namespace.test
index cded1f4..cb9bc8c 100644
--- a/tests/namespace.test
+++ b/tests/namespace.test
@@ -2953,6 +2953,45 @@ test namespace-54.1 {leak on namespace deletion} -constraints {memory} \
test namespace-55.1 {compiled ensembles inside compiled ensembles: Bug 6d2f249a01} {
info class [format %s constructor] oo::object
} ""
+
+test namespace-56.1 {bug f97d4ee020: mutually-entangled deletion} {
+ namespace eval ::testing {
+ proc abc {} {}
+ proc def {} {}
+ trace add command abc delete "rename ::testing::def {}; #"
+ trace add command def delete "rename ::testing::abc {}; #"
+ }
+ namespace delete ::testing
+} {}
+test namespace-56.2 {bug f97d4ee020: mutually-entangled deletion} {
+ namespace eval ::testing {
+ namespace eval abc {proc xyz {} {}}
+ namespace eval def {proc xyz {} {}}
+ trace add command abc::xyz delete "namespace delete ::testing::def {}; #"
+ trace add command def::xyz delete "namespace delete ::testing::abc {}; #"
+ }
+ namespace delete ::testing
+} {}
+test namespace-56.3 {bug f97d4ee020: mutually-entangled deletion} {
+ namespace eval ::testing {
+ variable gone {}
+ oo::class create CB {
+ variable cmd
+ constructor other {set cmd $other}
+ destructor {rename $cmd {}; lappend ::testing::gone $cmd}
+ }
+ namespace eval abc {
+ ::testing::CB create def ::testing::abc::ghi
+ ::testing::CB create ghi ::testing::abc::def
+ }
+ namespace delete abc
+ try {
+ return [lsort $gone]
+ } finally {
+ namespace delete ::testing
+ }
+ }
+} {::testing::abc::def ::testing::abc::ghi}
# cleanup
catch {rename cmd1 {}}