Instead of doing puts, you should use the setResult() method.
e.g.
interp.setResult( "Result of the command" );
The Jacl interpreter will then write the string to the console.
You can also save the output of the command like this:
set ret [my_custom_cmd arg1 arg2]
if { $ret == "expected result" } {
puts "test passed"
} else {
puts "test failed"
}
-Shawn
Thomas McKay wrote:
> Okay, I found the archive at
> http://www.mail-archive.com/tcljava@scriptics.com/ .
>
> Here's what I'm trying to do... Some of my custom command extensions to
> Jacl generate textual output. Now right now they simply print it in a
> console area of my application. My goal is to use the Jacl test framework
> to "catch" this output and compare it to what is expected. Now since the
> commands are effectively calling puts rather than returning a result, is
> there any standard way in Jacl (Tcl) to trap this?
>
> The one thought I had is to write a special command that forces stdin/stderr
> to a string which is then returned. Maybe eval can already do this?
>
> ---
> Thomas McKay
>
> Project Leader
> Microcosm Technologies, Inc.
> mailto:[EMAIL PROTECTED]
>
> ----------------------------------------------------------------
> The TclJava mailing list is sponsored by Scriptics Corporation.
> To subscribe: send mail to [EMAIL PROTECTED]
> with the word SUBSCRIBE as the subject.
> To unsubscribe: send mail to [EMAIL PROTECTED]
> with the word UNSUBSCRIBE as the subject.
> To send to the list, send email to '[EMAIL PROTECTED]'.
--
Shawn Boyce
QCOM Inc.
Email: [EMAIL PROTECTED]
Phone: (732) 617-1970 x11
Fax: (732) 617-1975
Web: http://www.qcominc.com/people/shawn
----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.