summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2019-12-01 11:59:41 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2019-12-01 11:59:41 (GMT)
commit3435c9713f7b20d9061a5b2758728e66846c8989 (patch)
tree673e664a9cf63b320fb80dce5e3e42a111eb271e
parent332401e6453aa9e5621de6fa085169ca2ce51c8c (diff)
downloadtcl-3435c9713f7b20d9061a5b2758728e66846c8989.zip
tcl-3435c9713f7b20d9061a5b2758728e66846c8989.tar.gz
tcl-3435c9713f7b20d9061a5b2758728e66846c8989.tar.bz2
add tcltest::SetupTest to make it easier to customize the -setup step of a test
-rw-r--r--library/tcltest/tcltest.tcl18
1 files changed, 17 insertions, 1 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl
index a7a68c7..2d36d13 100644
--- a/library/tcltest/tcltest.tcl
+++ b/library/tcltest/tcltest.tcl
@@ -1983,7 +1983,8 @@ proc tcltest::test {name description args} {
}
# First, run the setup script
- set code [catch {uplevel 1 $setup} setupMsg]
+ lassign [uplevel 1 [list [
+ namespace which SetupScript] $setup]] code setupMsg
if {$code == 1} {
set errorInfo(setup) $::errorInfo
set errorCodeRes(setup) $::errorCode
@@ -2338,6 +2339,8 @@ proc tcltest::Skipped {name constraints} {
return 0
}
+
+
# RunTest --
#
# This is where the body of a test is evaluated. The combination of
@@ -2359,6 +2362,19 @@ proc tcltest::RunTest {name script} {
return [list $actualAnswer $code]
}
+
+
+# SetupTest --
+#
+# Evaluates the -setup script for a test
+
+proc tcltest::SetupTest {name script} {
+ DebugPuts 3 [list Setup Script for $name $script]
+
+ set code [catch {uplevel 1 $setup} setupMsg]
+ return [list $code $setupMsg]
+}
+
#####################################################################
# tcltest::cleanupTestsHook --