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/border.test | |
| parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
| download | tk-contrib_patrick_fradin_code_cleanup.zip tk-contrib_patrick_fradin_code_cleanup.tar.gz tk-contrib_patrick_fradin_code_cleanup.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/border.test')
| -rw-r--r-- | tests/border.test | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/tests/border.test b/tests/border.test index 78d0fcd..34e1f7f 100644 --- a/tests/border.test +++ b/tests/border.test @@ -15,7 +15,7 @@ test border-1.1 {Tk_AllocBorderFromObj - converting internal reps} -constraints } -body { set x orange lindex $x 0 - button .b1 -bg $x -text .b1 + button .b1 -background $x -text .b1 lindex $x 0 testborder orange } -cleanup { @@ -27,10 +27,10 @@ test border-1.2 {Tk_AllocBorderFromObj - discard stale border} -constraints { set result {} } -body { set x orange - button .b1 -bg $x -text First + button .b1 -background $x -text First destroy .b1 lappend result [testborder orange] - button .b2 -bg $x -text Second + button .b2 -background $x -text Second lappend result [testborder orange] } -cleanup { destroy .b1 .b2 @@ -41,9 +41,9 @@ test border-1.3 {Tk_AllocBorderFromObj - reuse existing border} -constraints { set result {} } -body { set x orange - button .b1 -bg $x -text First + button .b1 -background $x -text First lappend result [testborder orange] - button .b2 -bg $x -text Second + button .b2 -background $x -text Second pack .b1 .b2 -side top lappend result [testborder orange] } -cleanup { @@ -57,13 +57,13 @@ test border-1.4 {Tk_AllocBorderFromObj - try other borders in list} -constraints set result {} } -body { set x purple - button .b1 -bg $x -text First + button .b1 -background $x -text First pack .b1 -side top lappend result [testborder purple] - button .t.b -bg $x -text Second + button .t.b -background $x -text Second pack .t.b -side top lappend result [testborder purple] - button .b2 -bg $x -text Third + button .b2 -background $x -text Third pack .b2 -side top lappend result [testborder purple] } -cleanup { @@ -78,11 +78,11 @@ test border-2.1 {Tk_Free3DBorder - reference counts} -constraints { set result {} } -body { set x purple - button .b1 -bg $x -text First + button .b1 -background $x -text First pack .b1 -side top - button .t.b -bg $x -text Second + button .t.b -background $x -text Second pack .t.b -side top - button .b2 -bg $x -text Third + button .b2 -background $x -text Third pack .b2 -side top lappend result [testborder purple] destroy .b1 @@ -104,16 +104,16 @@ test border-2.2 {Tk_Free3DBorder - unlinking from list} -constraints { set result {} } -body { set x purple - button .b -bg $x -text .b1 - button .t.b1 -bg $x -text .t.b1 - button .t.b2 -bg $x -text .t.b2 - button .t2.b1 -bg $x -text .t2.b1 - button .t2.b2 -bg $x -text .t2.b2 - button .t2.b3 -bg $x -text .t2.b3 - button .t3.b1 -bg $x -text .t3.b1 - button .t3.b2 -bg $x -text .t3.b2 - button .t3.b3 -bg $x -text .t3.b3 - button .t3.b4 -bg $x -text .t3.b4 + button .b -background $x -text .b1 + button .t.b1 -background $x -text .t.b1 + button .t.b2 -background $x -text .t.b2 + button .t2.b1 -background $x -text .t2.b1 + button .t2.b2 -background $x -text .t2.b2 + button .t2.b3 -background $x -text .t2.b3 + button .t3.b1 -background $x -text .t3.b1 + button .t3.b2 -background $x -text .t3.b2 + button .t3.b3 -background $x -text .t3.b3 + button .t3.b4 -background $x -text .t3.b4 lappend result [testborder purple] destroy .t2 lappend result [testborder purple] @@ -133,11 +133,11 @@ test border-3.1 {FreeBorderObjProc} -constraints { set result {} } -body { set x [format purple] - button .b -bg $x -text .b1 + button .b -background $x -text .b1 set y [format purple] - .b configure -bg $y + .b configure -background $y set z [format purple] - .b configure -bg $z + .b configure -background $z lappend result [testborder purple] set x red lappend result [testborder purple] |
