Re: Updating Tktest suite - GSoC project
Subject: Re: Updating Tktest suite - GSoC project
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-06 23:06:20 GMT
Hi,
Thanks for all the replies. If you would have some time, I've got some tiny questions
about the convention - they might have little matter, though I'd like
to learn good style.
Questions 3 & 4 refer to the 1.* Tktests that have a following pattern: (like in message.test)
foreach test {
{-aspect 3 3 bogus {expected integer but got "bogus"}}
{-background #ff0000 #ff0000 non-existent
[...]
} {
set name [lindex $test 0]
test message-1.$i {configuration options} { ...
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.
From manpage:
A test file should be able to be combined with
other test files and not interfere with them, even when configure
-singleproc 1 causes all files to be evaluated in a common interpreter.
A simple way to achieve this is to have your tests define all their
commands and variables in a namespace that is deleted when the test
file evaluation is complete. A good namespace to use is a child
namespace test of the namespace of the module you are testing.
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
3. For test 1.* {configuration option} which have all the same setups - which form to use?
proc createButton {} {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
update
}
[...]
} -setup {
createButton
.b configure -bd 4
}
or
proc createButton {option value} {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} -$option $value
pack .b
update
}
[...]
} -setup { createButton bd 4}
(or none of them:P)
4. For test 1.* {configuration option: ""} in the body
I thought abut using
.m cget -anchor
instead of
lindex [.m configure -anchor] 4
(sorry if I miss the concept :P)
test message-1.3 {configuration option: "anchor"} -setup {
createMessage
.m configure -aspect 3
} -body {
# lindex [.m configure -aspect] 3 ;# this was before
.m cget -aspect
} -cleanup {
destroy .m
} -result {3}
Thanks in advance,
Ania:)
------------------------------------------------------------------------- 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
_______________________________________________ Tcl-Core mailing list Tcl-Core@... https://lists.sourceforge.net/lists/listinfo/tcl-core
RSS Feed