summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2015-03-21 15:08:35 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2015-03-21 15:08:35 (GMT)
commit7dbf5ed0b0e60ff40474e45e7b0eb498d4eed3b9 (patch)
treedee2b8442329dbf2829bc09e204b9cbfaa14bdbe /tests
parent1292a0d927e1e406c26efa91c7f8b36087b2b767 (diff)
downloadtcl-7dbf5ed0b0e60ff40474e45e7b0eb498d4eed3b9.zip
tcl-7dbf5ed0b0e60ff40474e45e7b0eb498d4eed3b9.tar.gz
tcl-7dbf5ed0b0e60ff40474e45e7b0eb498d4eed3b9.tar.bz2
adding a test to reveal a problem with the fix of bug d87cb182053fd79b3
Diffstat (limited to 'tests')
-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