summaryrefslogtreecommitdiffstats
path: root/tests/tailcall.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-07-17 21:22:22 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-07-17 21:22:22 (GMT)
commit5234a59846f046760830b06488e2d214d0b2cf04 (patch)
treeeb303b04e47fe05468dc5620171a0ee2c8453095 /tests/tailcall.test
parent2fc3c8d6596a5d180b7f2c13451e8ec26144cb2b (diff)
parentad86656b196a9b34f2df43327c816d8099d7f3c8 (diff)
downloadtcl-5234a59846f046760830b06488e2d214d0b2cf04.zip
tcl-5234a59846f046760830b06488e2d214d0b2cf04.tar.gz
tcl-5234a59846f046760830b06488e2d214d0b2cf04.tar.bz2
merge trunk
Diffstat (limited to 'tests/tailcall.test')
-rw-r--r--tests/tailcall.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/tailcall.test b/tests/tailcall.test
index 2d04f82..26f3cbf 100644
--- a/tests/tailcall.test
+++ b/tests/tailcall.test
@@ -147,6 +147,36 @@ test tailcall-0.5 {tailcall is constant space} -constraints testnrelevels -setup
rename b {}
} -result {0 0 0 0 0 0}
+test tailcall-0.5.1 {tailcall is constant space} -constraints testnrelevels -setup {
+ #
+ # This test is related to [bug d87cb182053fd79b3]: the fix to that bug was
+ # to remove a call to TclSkipTailcall, which caused a violation of the
+ # constant-space property of tailcall in that particular
+ # configuration. This test was added to detect that, and insure that the
+ # problem is fixed.
+ #
+
+ proc b i {
+ if {$i == 1} {
+ depthDiff
+ }
+ if {[incr i] > 10} {
+ return [depthDiff]
+ }
+ tailcall dict b $i
+ }
+ set map0 [namespace ensemble configure dict -map]
+ set map $map0
+ dict set map b b
+ namespace ensemble configure dict -map $map
+} -body {
+ dict b 0
+} -cleanup {
+ rename b {}
+ namespace ensemble configure dict -map $map0
+ unset map map0
+} -result {0 0 0 0 0 0}
+
test tailcall-0.6 {tailcall is constant space} -constraints {testnrelevels knownBug} -setup {
#
# This test fails because ns-unknown is not NR-enabled