Re: tcltest Tk Applications



I just found a fix for the problem that I addressed in the previous posting. See the code inside "setupScript" in the test script below.

Greetings,

Erik Leunissen
==============


package require tcltest 2.2 namespace import -force tcltest::* tcltest::configure -verbose {body pass error}

set setupScript {
	interp create slave
	# But this does help:
	slave alias puts puts; # <------- FIX
}
set cleanupScript {
	interp delete slave
}


test errorOutput-1.1 {writes to stderr from main interp} -body { puts stderr "Do you read stderr (master)?" } -errorOutput "Do you read stderr (master)?\n" \ -result ""

test errorOutput-1.2 {writes to stderr from slave interp} -body {
	slave eval [list puts stderr "Do you read stderr (slave)?"]
} -errorOutput "Do you read stderr (slave)?\n" \
		-result "" -setup $setupScript -cleanup $cleanupScript

--
  leunissen@       nl | Merge the left part of these two lines into one,
e.          hccnet.   | respecting a character's position in a line.

.



Relevant Pages

  • Re: Slave interpreters, aliases, and upvar
    ... to use upvar to access variables in the slave? ... set interp ... upvar 1 $_var var ...
    (comp.lang.tcl)
  • Re: tcltest Tk Applications
    ... puts command which would redirect all stdout/stderr output to the master interp, and use the default puts command for everything else. ... I resolved the issues with non-standard files too and fixed a problem that had been created when defining the alias for puts. ... I've attached the complete setup for using slave interps with tcltest to this message. ...
    (comp.lang.tcl)
  • Re: How to un-source ?
    ... You may use separate interpreters for each source command, ... interp create slave ... slave eval source x.tcl ...
    (comp.lang.tcl)
  • Re: Redirecting stdout
    ... >> Try running the offending script in a slave interpreter. ... % interp eval $slave {close stdout; open nul w; puts hi!} ... but channels are per-interp. ...
    (comp.lang.tcl)
  • Re: Why second and next source calls are slower than first one?
    ... set slave [interp create slave_interp] ... Test.tcl creates toplevel window with mentioned gui objects. ...
    (comp.lang.tcl)