summaryrefslogtreecommitdiffstats
path: root/library/tcltest
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2019-12-02 22:04:41 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2019-12-02 22:04:41 (GMT)
commit36f4518f890ff81b22fbf1575775ffaf1c1a149b (patch)
treed087198b8e650384f38f76e0fdf666d1337393bd /library/tcltest
parent4f6ea8aef90242e6052cf743e6684e312c84873c (diff)
downloadtcl-36f4518f890ff81b22fbf1575775ffaf1c1a149b.zip
tcl-36f4518f890ff81b22fbf1575775ffaf1c1a149b.tar.gz
tcl-36f4518f890ff81b22fbf1575775ffaf1c1a149b.tar.bz2
Add tcltest::CleanupTest to make it easier to customize behaviour.
Diffstat (limited to 'library/tcltest')
-rw-r--r--library/tcltest/tcltest.tcl12
1 files changed, 11 insertions, 1 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl
index 4171965..28c50ef 100644
--- a/library/tcltest/tcltest.tcl
+++ b/library/tcltest/tcltest.tcl
@@ -2069,7 +2069,9 @@ proc tcltest::test {name description args} {
}
# Always run the cleanup script
- set code [catch {uplevel 1 $cleanup} cleanupMsg]
+ set code [catch {
+ uplevel 1 [list [namespace which CleanupTest] $cleanup]
+ } cleanupMsg]
if {$code == 1} {
set errorInfo(cleanup) $::errorInfo
set errorCodeRes(cleanup) $::errorCode
@@ -2382,6 +2384,14 @@ proc tcltest::SetupTest setup {
uplevel 1 $setup
}
+
+# CleanupTest --
+#
+# Evaluates the -cleanup script for a test
+proc tcltest::CleanupTest cleanup {
+ uplevel 1 $cleanup
+}
+
#####################################################################
# tcltest::cleanupTestsHook --