Donald G Porter | 7 Jul 19:50
Favicon

Re: Updating Tktest suite - GSoC project

Ania Pawelczyk wrote:
> 1. namespaces
> -should I create that? and names p.e. namespace eval testbutton. It's 
> recommended on the manpage, but I haven't noticed any recently updated 
> tcl or tk test using that.

Examples of Tcl *.test files using the recommended technique: chanio,
cmdMZ, encoding, error, fileSystem, iogt, io, main, parse, source.

This is more important in the Tcl test suite, where the default mode
is -singleproc 0.  The namespace separation helps avoid bad surprises
on occasional tests of the -singleproc 1 mode.

The Tk test suite defaults to -singleproc 1 (no one wants to pay Tk process
startup costs for every *.test file) so any troublesome conflicts are
going to get detected quickly.  In that circumstance, namespace protection
is less important.

> 2. Which convention of package require tcltest 2.1 to choose? And 
> tcltest 2.1 or 2?
>     if {[lsearch [namespace children] ::tcltest] == -1} {
>         package require tcltest 2.1
>         namespace import -force ::tcltest::*
>     }
> or
>     package require tcltest 2.1

Use this:

	package require tcltest 2.2
	namespace import ::tcltest::*

I'm assuming your work is aimed at the test suite to go with Tk 8.5.*
and later.  This implies a Tcl version of at least 8.5.0 as well.
Version 2.2 of tcltest has been available since Tcl release 8.4.0.
The misfeature of [namespace import] that lead to all the -force-ing
has been fixed since Tcl 8.4.12.  Code for the future, not the past.

--

-- 
| Don Porter          Mathematical and Computational Sciences Division |
| donald.porter@...             Information Technology Laboratory |
| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08

Gmane