summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-10-08 14:42:40 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-10-08 14:42:40 (GMT)
commit0d31e4cefc735abf4b5eb232c3b89effa9ebc3aa (patch)
treed6aee156688cbe239524349e78d8f2f79a79340a /tests
parent817534697915bca720f02388c1e9b6a0e72718c0 (diff)
downloadtcl-0d31e4cefc735abf4b5eb232c3b89effa9ebc3aa.zip
tcl-0d31e4cefc735abf4b5eb232c3b89effa9ebc3aa.tar.gz
tcl-0d31e4cefc735abf4b5eb232c3b89effa9ebc3aa.tar.bz2
[Bug 2874678]: Don't leak bignums in [dict incr]...
Diffstat (limited to 'tests')
-rw-r--r--tests/dict.test36
1 files changed, 23 insertions, 13 deletions
diff --git a/tests/dict.test b/tests/dict.test
index 5b08996..2d15909 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: dict.test,v 1.24.2.2 2008/12/15 23:26:59 dkf Exp $
+# RCS: @(#) $Id: dict.test,v 1.24.2.3 2009/10/08 14:42:40 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -18,6 +18,17 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
# Used for constraining memory leak tests
testConstraint memory [llength [info commands memory]]
+if {[testConstraint memory]} {
+ proc memtest script {
+ set end [lindex [split [memory info] \n] 3 3]
+ for {set i 0} {$i < 5} {incr i} {
+ uplevel 1 $script
+ set tmp $end
+ set end [lindex [split [memory info] \n] 3 3]
+ }
+ expr {$end - $tmp}
+ }
+}
# Procedure to help check the contents of a dictionary. Note that we
# can't just compare the string version because the order of the
@@ -819,10 +830,6 @@ test dict-19.1 {memory bug} -setup {
rename xxx {}
} -result [dict create c d a b]
test dict-19.2 {dict: testing for leaks} -setup {
- proc getbytes {} {
- set lines [split [memory info] "\n"]
- lindex [lindex $lines 3] 3
- }
# This test is made to stress object reference management
proc stress {} {
# A shared invalid dictinary
@@ -927,18 +934,21 @@ test dict-19.2 {dict: testing for leaks} -setup {
unset bepa
}
} -constraints memory -body {
- set end [getbytes]
- for {set i 0} {$i < 5} {incr i} {
- stress
- set tmp $end
- set end [getbytes]
+ memtest {
+ stress
}
- expr {$end - $tmp}
} -cleanup {
- unset -nocomplain end i tmp
- rename getbytes {}
rename stress {}
} -result 0
+test dict-19.3 {testing for leaks - Bug 2874678} -constraints memory -body {
+ set d aDictVar; # Force interpreted [dict incr]
+ memtest {
+ dict incr $d aKey 0
+ unset $d
+ }
+} -cleanup {
+ unset d
+} -result 0
test dict-20.1 {dict merge command} {
dict merge