From 7ba094d5c64eb844c4fec27beb598cf43c90b821 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 29 Oct 2009 17:21:17 +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 8c12216..4e8eeea 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.12 2007/12/13 15:26:04 dgp Exp $ +# RCS: @(#) $Id: apply.test,v 1.12.2.1 2009/10/29 17:21:17 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 6785855..57a1a3c 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.48.2.1 2008/07/25 20:30:58 andreas_kupries Exp $ +# RCS: @(#) $Id: compile.test,v 1.48.2.2 2009/10/29 17:21:18 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 bb50979..3ff7b71 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.19.4.1 2008/08/11 19:02:02 andreas_kupries Exp $ +# RCS: @(#) $Id: proc.test,v 1.19.4.2 2009/10/29 17:21:18 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..4aab459 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.25.2.1 2009/10/29 17:21:18 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