diff options
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} |