diff options
author | dgp <dgp@users.sourceforge.net> | 2007-08-24 21:34:19 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-08-24 21:34:19 (GMT) |
commit | ebc953ef5e8e0b2737ee370fce7d6198012b7ab9 (patch) | |
tree | 9ffa29cc44abc113e85de51d6c0b8266e0a51ca6 /tests/compExpr.test | |
parent | b6a2ba77d8842784d7c08493108d009ae42cae1b (diff) | |
download | tcl-ebc953ef5e8e0b2737ee370fce7d6198012b7ab9.zip tcl-ebc953ef5e8e0b2737ee370fce7d6198012b7ab9.tar.gz tcl-ebc953ef5e8e0b2737ee370fce7d6198012b7ab9.tar.bz2 |
* generic/tclCompExpr.c: Register literals found in expressions
* tests/compExpr.test: to restore literal sharing. Preserve numeric
intreps when literals are created for the first time. Correct memleak
in ExecConstantExprTree() and add test for the leak.
Diffstat (limited to 'tests/compExpr.test')
-rw-r--r-- | tests/compExpr.test | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/compExpr.test b/tests/compExpr.test index 991033f..f2075df 100644 --- a/tests/compExpr.test +++ b/tests/compExpr.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compExpr.test,v 1.13 2006/08/22 04:03:23 dgp Exp $ +# RCS: @(#) $Id: compExpr.test,v 1.14 2007/08/24 21:34:20 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -21,6 +21,9 @@ if {[catch {expr T1()} msg] && $msg eq {invalid command name "tcl::mathfunc::T1" testConstraint testmathfunctions 1 } +# Constrain memory leak tests +testConstraint memory [llength [info commands memory]] + catch {unset a} test compExpr-1.1 {TclCompileExpr procedure, successful expr parse and compile} { @@ -319,6 +322,26 @@ test compExpr-6.1 {LogSyntaxError procedure, error in expr longer than 60 chars} expr {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 foo 3 } -returnCodes error -match glob -result * +test compExpr-7.1 {Memory Leak} -constraints memory -setup { + proc getbytes {} { + set lines [split [memory info] \n] + lindex $lines 3 3 + } +} -body { + set end [getbytes] + for {set i 0} {$i < 5} {incr i} { + interp create slave + slave eval expr 1+2+3+4+5+6+7+8+9+10+11+12+13 + interp delete slave + set tmp $end + set end [getbytes] + } + set leakedBytes [expr {$end - $tmp}] +} -cleanup { + unset end i tmp + rename getbytes {} +} -result 0 + # cleanup catch {unset a} catch {unset b} |