Skip to content

Commit

Permalink
"eval destroy" -> "destroy {*}" in testcases/demo's
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Feb 12, 2024
1 parent 1ade324 commit 35a1e14
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 63 deletions.
2 changes: 1 addition & 1 deletion library/console.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ proc ::tk::ConsoleBind {w} {
tk::ConsoleInsert %W %A
}
bind Console <F9> {
eval destroy [winfo child .]
destroy {*}[winfo children .]
source -encoding utf-8 [file join $tk_library console.tcl]
}
if {[tk windowingsystem] eq "aqua"} {
Expand Down
2 changes: 1 addition & 1 deletion library/demos/rolodex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exec wish "$0" ${1+"$@"}

package require Tk

foreach i [winfo child .] {
foreach i [winfo children .] {
catch {destroy $i}
}

Expand Down
2 changes: 1 addition & 1 deletion library/demos/widget
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exec wish "$0" ${1+"$@"}
package require Tk 8.5
package require msgcat

eval destroy [winfo child .]
destroy {*}[winfo children .]
set tk_demoDirectory [file join [pwd] [file dirname [info script]]]
::msgcat::mcload $tk_demoDirectory
namespace import ::msgcat::mc
Expand Down
4 changes: 2 additions & 2 deletions tests/color.test
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ test color-2.11 {Tk_GetColor, 6 hex digits, last one invalid} -body {
} -returnCodes error -result {invalid color name "#12345g"}

test color-3.1 {Tk_FreeColor procedure, reference counting} colorsFree {
eval destroy [winfo child .t]
destroy {*}[winfo children .t]
mkColors .t.c 40 6 0 240 240 0 -6 0 0 0 -40
pack .t.c
mkColors .t.c2 20 1 250 0 0 -10 0 0 0 0 0
Expand All @@ -223,7 +223,7 @@ test color-3.1 {Tk_FreeColor procedure, reference counting} colorsFree {
lappend result [colorsFree .t]
} {0 1}
test color-3.2 {Tk_FreeColor procedure, flushing stressed cmap information} colorsFree {
eval destroy [winfo child .t]
destroy {*}[winfo children .t]
mkColors .t.c 40 6 0 240 240 0 -6 0 0 0 -40
pack .t.c
mkColors .t.c2 20 1 250 0 0 -10 0 0 0 0 0
Expand Down
2 changes: 1 addition & 1 deletion tests/grid.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ proc grid_reset {{test ?} {top .}} {
gets stdin
}
}
eval destroy [winfo children $top]
destroy {*}[winfo children $top]
update
foreach {cols rows} [grid size .] {}
for {set i 0} {$i <= $cols} {incr i} {
Expand Down
4 changes: 2 additions & 2 deletions tests/message.test
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,15 @@ test message-2.2 {Tk_MessageObjCmd procedure} -body {
} -returnCodes {error} -result {bad window path name "foo"}
test message-2.3 {Tk_MessageObjCmd procedure} -body {
catch {message foo}
winfo child .
winfo children .
} -result {}

test message-2.4 {Tk_MessageObjCmd procedure} -body {
message .s -gorp dump
} -returnCodes {error} -result {unknown option "-gorp"}
test message-2.5 {Tk_MessageObjCmd procedure} -body {
catch {message .s -gorp dump}
winfo child .
winfo children .
} -result {}


Expand Down
8 changes: 4 additions & 4 deletions tests/oldpack.test
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ test oldpack-7.2 {multiple expanded windows} -body {
[winfo geometry .pack.red]
} -result {70x20+30+77 40x40+45+30 10x20+60+3}
test oldpack-7.3 {multiple expanded windows} -body {
foreach i [winfo child .pack] {
foreach i [winfo children .pack] {
pack unpack $i
}
pack append .pack .pack.green {left e fill} .pack.red {left expand fill} \
Expand All @@ -412,7 +412,7 @@ test oldpack-7.3 {multiple expanded windows} -body {
[winfo geometry .pack.blue]
} -result {40x100+0+0 20x100+40+0 40x40+60+0}
test oldpack-7.4 {multiple expanded windows} -body {
foreach i [winfo child .pack] {
foreach i [winfo children .pack] {
pack unpack $i
}
pack append .pack .pack.red {top expand} .pack.violet {top expand} \
Expand All @@ -422,15 +422,15 @@ test oldpack-7.4 {multiple expanded windows} -body {
[winfo geometry .pack.blue]
} -result {10x20+45+5 80x20+10+35 40x40+60+60}
test oldpack-7.5 {multiple expanded windows} -body {
foreach i [winfo child .pack] {
foreach i [winfo children .pack] {
pack unpack $i
}
pack append .pack .pack.green {right frame s} .pack.red {top expand}
update
list [winfo geometry .pack.green] [winfo geometry .pack.red]
} -result {30x40+70+60 10x20+30+40}
test oldpack-7.6 {multiple expanded windows} -body {
foreach i [winfo child .pack] {
foreach i [winfo children .pack] {
pack unpack $i
}
pack append .pack .pack.violet {bottom frame e} .pack.red {right expand}
Expand Down
6 changes: 3 additions & 3 deletions tests/pack.test
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ test pack-17.2 {PackLostContentProc procedure} -setup {
test pack-18.1.1 {unmap content when container unmapped} -constraints {
macOrUnix failsOnUbuntu failsOnXQuarz
} -setup {
destroy {*}[winfo child .pack]
destroy {*}[winfo children .pack]
# adjust the position of .pack before test to avoid a screen switch
# that occurs with window managers that have desktops four times as big
# as the screen (screen switch causes scale and other tests to fail).
Expand All @@ -1580,7 +1580,7 @@ test pack-18.1.1 {unmap content when container unmapped} -constraints {
test pack-18.1.2 {unmap content when container unmapped} -constraints {
win
} -setup {
destroy {*}[winfo child .pack]
destroy {*}[winfo children .pack]
# adjust the position of .pack before test to avoid a screen switch
# that occurs with window managers that have desktops four times as big
# as the screen (screen switch causes scale and other tests to fail).
Expand All @@ -1601,7 +1601,7 @@ test pack-18.1.2 {unmap content when container unmapped} -constraints {
} -result {1 0 200 75 1}

test pack-18.2 {unmap content when container unmapped} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
destroy {*}[winfo child .pack]
destroy {*}[winfo children .pack]
# adjust the position of .pack before test to avoid a screen switch
# that occurs with window managers that have desktops four times as big
# as the screen (screen switch causes scale and other tests to fail).
Expand Down
4 changes: 1 addition & 3 deletions tests/raise.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ namespace import -force tcltest::test
# make it easy to detect differences in order.

proc raise_setup {} {
foreach i [winfo child .raise] {
destroy $i
}
destroy {*}[winfo children .raise]
update idletasks
foreach i {a b c d e} {
label .raise.$i -text $i -relief raised -bd 2
Expand Down
4 changes: 2 additions & 2 deletions tests/scale.test
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,14 @@ test scale-2.2 {Tk_ScaleCmd procedure} -body {
} -returnCodes error -result {bad window path name "foo"}
test scale-2.3 {Tk_ScaleCmd procedure} -body {
catch {scale foo}
winfo child .
winfo children .
} -result {}
test scale-2.4 {Tk_ScaleCmd procedure} -body {
scale .s -gorp dumb
} -returnCodes error -result {unknown option "-gorp"}
test scale-2.5 {Tk_ScaleCmd procedure} -body {
catch {scale .s -gorp dumb}
winfo child .
winfo children .
} -result {}


Expand Down
2 changes: 1 addition & 1 deletion tests/ttk/ttk.test
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ test ttk-ensemble-5 "style element create: valid" -body {
ttk::style element create plain.background from default
} -returnCodes 0 -result ""

eval destroy [winfo children .]
destroy {*}[winfo children .]

tcltest::cleanupTests

Expand Down
Loading

0 comments on commit 35a1e14

Please sign in to comment.