diff options
author | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
---|---|---|
committer | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
commit | 48c9fcb7281cc6aa076113db874c7ae0e105795d (patch) | |
tree | 7187940ff056462bfa41705a2ce04d0ed07d424e /tests/config.test | |
parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
download | tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.zip tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.gz tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.bz2 |
Contribution by Patrick Fradin <patrick.fradin@planar.com>contrib_patrick_fradin_code_cleanup
Quoting his mail:
<pre>
==========================================================
Hi Jeff,
I spent some of my time to contribute to the TclTk community ! I'm in
late for Christmas gift but like we said in French : "Mieux vaut tard
que jamais". ;-)
I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and
Tk library directories (library, tools and tests) to correct a lot of
warnings and few errors. (encapsulate some expr, use 'chan xxx'
instead of fconfigure, fileevent...)
I've made some improvements too :
Examples :
- Use 'lassign' instead of many 'lindex' of 'foreach/break' loop.
- Use 'in' or 'ni' operators instead of 'lsearch -exact' or to
factorise some eq/ne && / || tests.
- Use 'eq' or 'ne' to tests strings instead of '==' or '!='.
- Use 'unset -nocomplain' to avoid 'catch {unset...}'.
- Remove some useless catch around 'destroy' calls.
- Use expand {*} instead of 'eval'. Don't touch a lot of code because
I don't know all structs and lists. I think it could be a greater
improvement to reduce 'eval' calls.
Due to previous experience, I dot not change any indentation ! ;-)
==========================================================
</pre>
Diffstat (limited to 'tests/config.test')
-rw-r--r-- | tests/config.test | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/tests/config.test b/tests/config.test index 8f7aa9f..5ba4933 100644 --- a/tests/config.test +++ b/tests/config.test @@ -18,13 +18,12 @@ proc killTables {} { deleteWindows foreach t {alltypes chain2 chain1 configerror internal new notenoughparams twowindows} { - while {[testobjconfig info $t] != ""} { + while {[testobjconfig info $t] ne ""} { testobjconfig delete $t } } } - option clear deleteWindows if {[testConstraint testobjconfig]} { @@ -119,7 +118,6 @@ test config-1.9 {Tk_CreateOptionTable - chained tables} -constraints { killTables } -result {one four one} - test config-2.1 {Tk_DeleteOptionTable - reference counts} -constraints { testobjconfig } -body { @@ -1110,7 +1108,6 @@ test config-4.115 {DoObjConfig - custom internal value} -constraints { killTables } -result {THIS IS A TEST} - test config-5.1 {ObjectIsEmpty - object is already string} -constraints { testobjconfig } -body { @@ -1135,7 +1132,6 @@ test config-5.3 {ObjectIsEmpty - must convert back to string} -constraints { killTables } -result {} - test config-6.1 {GetOptionFromObj - cached answer} -constraints { testobjconfig } -body { @@ -1185,7 +1181,6 @@ test config-6.6 {GetOptionFromObj - synonym} -constraints testobjconfig -body { killTables } -result {red} - if {[testConstraint testobjconfig]} { testobjconfig alltypes .a } @@ -1277,7 +1272,6 @@ if {[testConstraint testobjconfig]} { killTables } - test config-8.1 {Tk_RestoreSavedOptions - restore in proper order} -constraints { testobjconfig } -body { @@ -1548,7 +1542,7 @@ test config-9.12 {Tk_FreeConfigOptions/FreeResources - not special} -constraints test config-9.13 {Tk_FreeConfigOptions/FreeResources - custom internal form} -constraints { testobjconfig } -body { - catch {destroy .fpp} + destroy .fpp testobjconfig internal .foo .foo configure -custom "foobar" destroy .foo @@ -1557,7 +1551,6 @@ if {[testConstraint testobjconfig]} { killTables } - test config-10.1 {Tk_GetOptionInfo - one item} -constraints testobjconfig -body { testobjconfig alltypes .foo .foo configure -relief groove @@ -1592,7 +1585,6 @@ if {[testConstraint testobjconfig]} { killTables } - if {[testConstraint testobjconfig]} { testobjconfig alltypes .a } @@ -1613,7 +1605,6 @@ if {[testConstraint testobjconfig]} { killTables } - if {[testConstraint testobjconfig]} { testobjconfig internal .a } @@ -1702,7 +1693,6 @@ if {[testConstraint testobjconfig]} { killTables } - test config-13.1 {proper cleanup of options with widget destroy} -body { button .w -cursor crosshair destroy .w |