summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/for.test34
1 files changed, 32 insertions, 2 deletions
diff --git a/tests/for.test b/tests/for.test
index c5803ee..8936682 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -882,7 +882,7 @@ test for-7.4 {Bug 3614226: ensure that continue cleans up the expansion stack} m
expr {$end - $tmp}
}}
} 0
-test for-7.5 {Bug 3614226: ensure that break cleans up the expansion stack} memory {
+test for-7.5 {Bug 3614226: ensure that break cleans up the combination of main and expansion stack} memory {
apply {{} {
set l [lrepeat 50 p q r]
# Can't use [memtest]; must be careful when we change stack frames
@@ -897,7 +897,7 @@ test for-7.5 {Bug 3614226: ensure that break cleans up the expansion stack} memo
expr {$end - $tmp}
}}
} 0
-test for-7.6 {Bug 3614226: ensure that continue cleans up the expansion stack} memory {
+test for-7.6 {Bug 3614226: ensure that continue cleans up the combination of main and expansion stack} memory {
apply {{} {
set l [lrepeat 50 p q r]
# Can't use [memtest]; must be careful when we change stack frames
@@ -912,6 +912,36 @@ test for-7.6 {Bug 3614226: ensure that continue cleans up the expansion stack} m
expr {$end - $tmp}
}}
} 0
+test for-7.7 {Bug 3614226: ensure that break only cleans up the right amount} memory {
+ apply {{} {
+ set l [lrepeat 50 p q r]
+ # Can't use [memtest]; must be careful when we change stack frames
+ set end [meminfo]
+ for {set i 0} {$i < 5} {incr i} {
+ unset -nocomplain {*}[for {set x 0} {[incr x]<50} {} {
+ puts [puts {*}$l {*}[puts a b c {*}$l {*}[break] d e f]]
+ }]
+ set tmp $end
+ set end [meminfo]
+ }
+ expr {$end - $tmp}
+ }}
+} 0
+test for-7.8 {Bug 3614226: ensure that continue only cleans up the right amount} memory {
+ apply {{} {
+ set l [lrepeat 50 p q r]
+ # Can't use [memtest]; must be careful when we change stack frames
+ set end [meminfo]
+ for {set i 0} {$i < 5} {incr i} {
+ unset -nocomplain {*}[for {set x 0} {[incr x]<50} {} {
+ puts [puts {*}$l {*}[puts a b c {*}$l {*}[continue] d e f]]
+ }]
+ set tmp $end
+ set end [meminfo]
+ }
+ expr {$end - $tmp}
+ }}
+} 0
# cleanup
::tcltest::cleanupTests