diff options
author | dgp <dgp@noemail.net> | 2003-07-18 21:01:31 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2003-07-18 21:01:31 (GMT) |
commit | 1ea4f5d80a43d73060118a6cbe592ca6c3f5d154 (patch) | |
tree | cc557671019e89fedd2d6c3cd71ed72587fd3a22 /library | |
parent | 09d8837016eff2787a9af970ab29ef92e102575b (diff) | |
download | tcl-1ea4f5d80a43d73060118a6cbe592ca6c3f5d154.zip tcl-1ea4f5d80a43d73060118a6cbe592ca6c3f5d154.tar.gz tcl-1ea4f5d80a43d73060118a6cbe592ca6c3f5d154.tar.bz2 |
* doc/tcltest.n: Restored the [Eval] proc to replace
* library/tcltest/tcltest.tcl: the [::puts] command when either the
-output or -error option for [test] is in use, in order to capture
data written to the output or error channels for comparison against
what is expected. This is easier to document and agrees better with
most user expectations than the previous attempt to replace [puts]
only in the caller's namespace. Documentation made more precise on
the subject. [Bug 706359]
FossilOrigin-Name: a49cd5c3a335849b242fd82d53553394614e87df
Diffstat (limited to 'library')
-rw-r--r-- | library/tcltest/tcltest.tcl | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 1bc0037..934f8f0 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -16,7 +16,7 @@ # Contributions from Don Porter, NIST, 2002. (not subject to US copyright) # All rights reserved. # -# RCS: @(#) $Id: tcltest.tcl,v 1.78.2.4 2003/07/16 14:31:35 dgp Exp $ +# RCS: @(#) $Id: tcltest.tcl,v 1.78.2.5 2003/07/18 21:01:32 dgp Exp $ package require Tcl 8.3 ;# uses [glob -directory] namespace eval tcltest { @@ -1605,26 +1605,16 @@ proc tcltest::Eval {script {ignoreOutput 1}} { if {!$ignoreOutput} { set outData {} set errData {} - set callerHasPuts [llength [uplevel 1 { - ::info commands [::namespace current]::puts - }]] - if {$callerHasPuts} { - uplevel 1 [list ::rename puts [namespace current]::Replace::Puts] - } else { - interp alias {} [namespace current]::Replace::Puts {} ::puts - } - uplevel 1 [list ::namespace import [namespace origin Replace::puts]] + rename ::puts [namespace current]::Replace::Puts + namespace eval :: \ + [list namespace import [namespace origin Replace::puts]] namespace import Replace::puts } set result [uplevel 1 $script] if {!$ignoreOutput} { namespace forget puts - uplevel 1 ::namespace forget puts - if {$callerHasPuts} { - uplevel 1 [list ::rename [namespace current]::Replace::Puts puts] - } else { - interp alias {} [namespace current]::Replace::Puts {} - } + namespace eval :: namespace forget puts + rename [namespace current]::Replace::Puts ::puts } return $result } |