summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2016-05-21 09:30:02 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2016-05-21 09:30:02 (GMT)
commitc559956bdbeb3be7c36bff03736f2f58b326085b (patch)
treed4e67308decc65c55eb0f926021d438365dcc6ef /tests
parent4fad9227456604fb7bf7903a8a9245a55d421838 (diff)
parentca66ff4b66c7c2c37cf104ead999ae2fc8c85747 (diff)
downloadtcl-c559956bdbeb3be7c36bff03736f2f58b326085b.zip
tcl-c559956bdbeb3be7c36bff03736f2f58b326085b.tar.gz
tcl-c559956bdbeb3be7c36bff03736f2f58b326085b.tar.bz2
Fix for [f97d4ee020]; use a two-stage approach to avoid quadratic behavior.
Diffstat (limited to 'tests')
-rw-r--r--tests/assemble.test19
-rw-r--r--tests/namespace.test39
2 files changed, 49 insertions, 9 deletions
diff --git a/tests/assemble.test b/tests/assemble.test
index 9813545..d17bfd9 100644
--- a/tests/assemble.test
+++ b/tests/assemble.test
@@ -3281,7 +3281,9 @@ test assemble-51.4 {memory leak testing} memory {
} 0
test assemble-52.1 {Bug 3154ea2759} {
- proc __BEGIN {} {
+ apply {{} {
+ # Needs six exception ranges to force the range allocations to use the
+ # malloced store.
::tcl::unsupported::assemble {
beginCatch @badLabel
push error
@@ -3291,7 +3293,7 @@ test assemble-52.1 {Bug 3154ea2759} {
push 0
jump @okLabel
label @badLabel
- push 1; # should be pushReturnCode
+ push 1; # should be pushReturnCode
label @okLabel
endCatch
pop
@@ -3304,7 +3306,7 @@ test assemble-52.1 {Bug 3154ea2759} {
push 0
jump @okLabel2
label @badLabel2
- push 1; # should be pushReturnCode
+ push 1; # should be pushReturnCode
label @okLabel2
endCatch
pop
@@ -3317,7 +3319,7 @@ test assemble-52.1 {Bug 3154ea2759} {
push 0
jump @okLabel3
label @badLabel3
- push 1; # should be pushReturnCode
+ push 1; # should be pushReturnCode
label @okLabel3
endCatch
pop
@@ -3330,7 +3332,7 @@ test assemble-52.1 {Bug 3154ea2759} {
push 0
jump @okLabel4
label @badLabel4
- push 1; # should be pushReturnCode
+ push 1; # should be pushReturnCode
label @okLabel4
endCatch
pop
@@ -3343,7 +3345,7 @@ test assemble-52.1 {Bug 3154ea2759} {
push 0
jump @okLabel5
label @badLabel5
- push 1; # should be pushReturnCode
+ push 1; # should be pushReturnCode
label @okLabel5
endCatch
pop
@@ -3356,13 +3358,12 @@ test assemble-52.1 {Bug 3154ea2759} {
push 0
jump @okLabel6
label @badLabel6
- push 1; # should be pushReturnCode
+ push 1; # should be pushReturnCode
label @okLabel6
endCatch
pop
}
- }
- __BEGIN
+ }}
} {}; # must not crash
rename fillTables {}
diff --git a/tests/namespace.test b/tests/namespace.test
index 47c8001..5c5783b 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 {}}