Index: library/tcltest/tcltest.tcl ================================================================== --- library/tcltest/tcltest.tcl +++ library/tcltest/tcltest.tcl @@ -1981,11 +1981,13 @@ set coreModTime [file mtime [file join [workingDirectory] core]] } } # First, run the setup script - set code [catch {uplevel 1 $setup} setupMsg] + set code [catch { + uplevel 1 [list [namespace which SetupTest] $setup] + } setupMsg] if {$code == 1} { set errorInfo(setup) $::errorInfo set errorCodeRes(setup) $::errorCode } set setupFailure [expr {$code != 0}] @@ -2335,10 +2337,12 @@ return 1 } } return 0 } + + # RunTest -- # # This is where the body of a test is evaluated. The combination of # [RunTest] and [Eval] allows the output and error output of the test @@ -2357,10 +2361,20 @@ set code [catch {uplevel 1 $script} actualAnswer] return [list $actualAnswer $code] } + + +# SetupTest -- +# +# Evaluates the -setup script for a test + +proc tcltest::SetupTest setup { + uplevel 1 $setup +} + ##################################################################### # tcltest::cleanupTestsHook -- # # This hook allows a harness that builds upon tcltest to specify