From 4c88e5710e2844b84cd5893e41bc3d369c37d65c Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 29 Oct 2009 17:21:48 +0000 Subject: test hygiene for the ::tmp variable --- tests/apply.test | 6 ++++-- tests/compile.test | 3 ++- tests/proc.test | 3 ++- tests/reg.test | 14 +++++++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/apply.test b/tests/apply.test index 95f4fd8..809fdbe 100644 --- a/tests/apply.test +++ b/tests/apply.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: apply.test,v 1.13 2008/07/19 22:50:39 nijtmans Exp $ +# RCS: @(#) $Id: apply.test,v 1.14 2009/10/29 17:21:48 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.2 @@ -277,7 +277,7 @@ test apply-9.1 {leaking internal rep} -setup { set leakedBytes [expr {$end - $tmp}] } -cleanup { rename getbytes {} - unset lam + unset -nocomplain lam end i tmp leakedBytes } -result 0 test apply-9.2 {leaking internal rep} -setup { proc getbytes {} { @@ -294,6 +294,7 @@ test apply-9.2 {leaking internal rep} -setup { set leakedBytes [expr {$end - $tmp}] } -cleanup { rename getbytes {} + unset -nocomplain end i tmp leakedBytes } -result 0 test apply-9.3 {leaking internal rep} -setup { proc getbytes {} { @@ -312,6 +313,7 @@ test apply-9.3 {leaking internal rep} -setup { set leakedBytes [expr {$end - $tmp}] } -cleanup { rename getbytes {} + unset -nocomplain end i x tmp leakedBytes } -result 0 # Tests for the avoidance of recompilation diff --git a/tests/compile.test b/tests/compile.test index 557b3b5..d9567cc 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.50 2008/11/17 22:37:36 ferrieux Exp $ +# RCS: @(#) $Id: compile.test,v 1.51 2009/10/29 17:21:48 dgp Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -296,6 +296,7 @@ test compile-12.1 {testing literal leak on interp delete} -setup { set leakedBytes [expr {$end - $tmp}] } -cleanup { rename getbytes {} + unset -nocomplain end i tmp leakedBytes } -result 0 # Special test for a memory error in a preliminary fix of [Bug 467523]. # It requires executing a helpfile. Presumably the child process is diff --git a/tests/proc.test b/tests/proc.test index 6ef6811..789c671 100644 --- a/tests/proc.test +++ b/tests/proc.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: proc.test,v 1.20 2008/08/11 20:40:41 andreas_kupries Exp $ +# RCS: @(#) $Id: proc.test,v 1.21 2009/10/29 17:21:48 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -322,6 +322,7 @@ test proc-4.8 {TclCreateProc, procbody obj, no leak on multiple iterations} -set set leakedBytes [expr {$end - $tmp}] } -cleanup { rename getbytes {} + unset -nocomplain end i tmp leakedBytes } -result 0 test proc-5.1 {Bytecompiling noop; test for correct argument substitution} { diff --git a/tests/reg.test b/tests/reg.test index 79eaaa0..46b5e64 100644 --- a/tests/reg.test +++ b/tests/reg.test @@ -9,7 +9,7 @@ # # Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. # -# RCS: @(#) $Id: reg.test,v 1.25 2008/03/19 13:39:28 dkf Exp $ +# RCS: @(#) $Id: reg.test,v 1.26 2009/10/29 17:21:48 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -1050,13 +1050,17 @@ test reg-33.8 {Bug 505048} { test reg-33.9 {Bug 505048} { regexp -indices -inline {\A\s*[^b]*b} ab } {{0 1}} -test reg-33.10 {Bug 840258} { +test reg-33.10 {Bug 840258} -body { regsub {(^|\n)+\.*b} \n.b {} tmp -} 1 -test reg-33.11 {Bug 840258} { +} -cleanup { + unset tmp +} -result 1 +test reg-33.11 {Bug 840258} -body { regsub {(^|[\n\r]+)\.*\?<.*?(\n|\r)+} \ "TQ\r\n.?<5000267>Test already stopped\r\n" {} tmp -} 1 +} -cleanup { + unset tmp +} -result 1 test reg-33.12 {Bug 1810264 - bad read} { regexp {\3161573148} {\3161573148} } 0 -- cgit v0.12