summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/demos/pendulum.tcl16
-rw-r--r--library/demos/square2
-rw-r--r--tests/arc.tcl4
-rw-r--r--tests/button.test8
-rw-r--r--tests/canvText.test4
-rw-r--r--tests/canvas.test4
-rw-r--r--tests/cmap.tcl2
-rw-r--r--tests/image.test2
-rw-r--r--tests/scrollbar.test104
-rw-r--r--tests/select.test10
-rw-r--r--tests/text.test12
-rw-r--r--tests/textBTree.test10
-rw-r--r--tests/textDisp.test90
-rw-r--r--tests/textTag.test12
-rw-r--r--tests/ttk/treeview.test4
-rw-r--r--tests/ttk/ttk.test2
-rw-r--r--tests/visual.test10
-rw-r--r--tests/winFont.test16
-rw-r--r--tests/winSend.test18
-rw-r--r--tests/winfo.test14
20 files changed, 172 insertions, 172 deletions
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index d344d8d..6422c67 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -126,16 +126,16 @@ bind $w.c <ButtonRelease-1> {
}
bind $w.c <Configure> {
%W coords plate 0 25 %w 25
- set home [expr %w/2]
- %W coords pivot [expr $home-5] 20 [expr $home+5] 30
+ set home [expr {%w/2}]
+ %W coords pivot [expr {$home-5}] 20 [expr {$home+5}] 30
}
bind $w.k <Configure> {
- set psh [expr %h/2]
- set psw [expr %w/2]
- %W coords x_axis 2 $psh [expr %w-2] $psh
- %W coords y_axis $psw [expr %h-2] $psw 2
- %W coords label_dtheta [expr $psw-4] 6
- %W coords label_theta [expr %w-6] [expr $psh+4]
+ set psh [expr {%h/2}]
+ set psw [expr {%w/2}]
+ %W coords x_axis 2 $psh [expr {%w-2}] $psh
+ %W coords y_axis $psw [expr {%h-2}] $psw 2
+ %W coords label_dtheta [expr {$psw-4}] 6
+ %W coords label_theta [expr {%w-6}] [expr {$psh+4}]
}
# This procedure is the "business" part of the simulation that does
diff --git a/library/demos/square b/library/demos/square
index 1d7eb20..6ce91b8 100644
--- a/library/demos/square
+++ b/library/demos/square
@@ -27,7 +27,7 @@ focus .s
proc center {x y} {
set a [.s size]
- .s position [expr $x-($a/2)] [expr $y-($a/2)]
+ .s position [expr {$x-($a/2)}] [expr {$y-($a/2)}]
}
# The procedures below provide a simple form of animation where
diff --git a/tests/arc.tcl b/tests/arc.tcl
index d0a93ea..0126c7d 100644
--- a/tests/arc.tcl
+++ b/tests/arc.tcl
@@ -99,7 +99,7 @@ bind .t.c <Shift-1> {
}
bind .t.c <Shift-B1-Motion> {
- .t.c move circle [expr %x-$curx] [expr %y-$cury]
+ .t.c move circle [expr {%x-$curx}] [expr {%y-$cury}]
set curx %x
set cury %y
}
@@ -127,7 +127,7 @@ bind .t.c a {
}
incr i $delta
c -start $i
- c -extent [expr 360-2*$i]
+ c -extent [expr {360-2*$i}]
after 20
update
}
diff --git a/tests/button.test b/tests/button.test
index b953197..e5cb1b9 100644
--- a/tests/button.test
+++ b/tests/button.test
@@ -3444,12 +3444,12 @@ test button-5.24 {ConfigureButton - computing geometry} -constraints {
set expectedwidth [expr {$textwidth + 2*[.b cget -borderwidth] \
+ 2*[.b cget -highlightthickness] + 2*[.b cget -padx]}]
incr expectedwidth 2 ; # added (hardcoded) in tkUnixButton.c
- set result [expr $expectedwidth == [winfo reqwidth .b]]
+ set result [expr {$expectedwidth == [winfo reqwidth .b]}]
set linespace [lindex [font metrics [.b cget -font] -displayof .b] 5]
set expectedheight [expr {$linespace + 2*[.b cget -borderwidth] \
+ 2*[.b cget -highlightthickness] + 2*[.b cget -pady]}]
incr expectedheight 2 ; # added (hardcoded) in tkUnixButton.c
- lappend result [expr $expectedheight == [winfo reqheight .b]]
+ lappend result [expr {$expectedheight == [winfo reqheight .b]}]
# 2. button with a bitmap image
# there is no access to characteristics the predefined bitmaps,
# so define one as an image (copied from questhead.xbm)
@@ -3468,11 +3468,11 @@ test button-5.24 {ConfigureButton - computing geometry} -constraints {
set expectedwidth [expr {[image width $myquesthead] + 2*[.b cget -borderwidth] \
+ 2*[.b cget -highlightthickness]}]
incr expectedwidth 2 ; # added (hardcoded) in tkUnixButton.c
- lappend result [expr $expectedwidth == [winfo reqwidth .b]]
+ lappend result [expr {$expectedwidth == [winfo reqwidth .b]}]
set expectedheight [expr {[image height $myquesthead] + 2*[.b cget -borderwidth] \
+ 2*[.b cget -highlightthickness]}]
incr expectedheight 2 ; # added (hardcoded) in tkUnixButton.c
- lappend result [expr $expectedheight == [winfo reqheight .b]]
+ lappend result [expr {$expectedheight == [winfo reqheight .b]}]
} -cleanup {
destroy .b
} -result {1 1 1 1}
diff --git a/tests/canvText.test b/tests/canvText.test
index c04cb63..b2af39b 100644
--- a/tests/canvText.test
+++ b/tests/canvText.test
@@ -269,7 +269,7 @@ test canvText-6.1 {ComputeTextBbox procedure} -constraints fonts -setup {
.c create text 0 0 -tag test
.c itemconfig test -font $font -text 0
expr {[.c itemconfig test -anchor n; .c bbox test] \
- eq "[expr -$ax/2-1] 0 [expr $ax/2+1] $ay"}
+ eq "[expr {-$ax/2-1}] 0 [expr {$ax/2+1}] $ay"}
} -cleanup {
.c delete test
} -result 1
@@ -282,7 +282,7 @@ test canvText-6.2 {ComputeTextBbox procedure} -constraints fonts -setup {
.c create text 0 0 -tag test
.c itemconfig test -font $font -text 0
expr {[.c itemconfig test -anchor nw; .c bbox test] \
- eq "-1 0 [expr $ax+1] $ay"}
+ eq "-1 0 [expr {$ax+1}] $ay"}
} -cleanup {
.c delete test
} -result 1
diff --git a/tests/canvas.test b/tests/canvas.test
index 2b0da48..fe4c2b7 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -354,9 +354,9 @@ test canvas-9.1 {canvas id creation and deletion} -setup {
for {set i 0} {$i < $size} {incr i} {
set x [expr {-10 + 3*$i}]
for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} {
- .c create rect ${x}c ${y}c [expr $x+2]c [expr $y+2]c \
+ .c create rect ${x}c ${y}c [expr {$x+2}]c [expr {$y+2}]c \
-outline black -fill blue -tags rect
- .c create text [expr $x+1]c [expr $y+1]c -text "$i,$j" \
+ .c create text [expr {$x+1}]c [expr {$y+1}]c -text "$i,$j" \
-anchor center -tags text
}
}
diff --git a/tests/cmap.tcl b/tests/cmap.tcl
index cca4c24..ea19131 100644
--- a/tests/cmap.tcl
+++ b/tests/cmap.tcl
@@ -19,7 +19,7 @@ proc colors {w redInc greenInc blueInc} {
for {set x 0} {$x < 8} {incr x} {
frame $w.f$x,$y -width 40 -height 40 -bd 2 -relief raised \
-bg [format #%02x%02x%02x $red $green $blue]
- place $w.f$x,$y -x [expr 40*$x] -y [expr 40*$y]
+ place $w.f$x,$y -x [expr {40*$x}] -y [expr {40*$y}]
incr red $redInc
incr green $greenInc
incr blue $blueInc
diff --git a/tests/image.test b/tests/image.test
index 861b086..5842ce3 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -47,7 +47,7 @@ test image-1.6 {Tk_ImageCmd procedure, "create" option} -constraints {
scan [image create test] image%d first
image create test myimage
scan [image create test -variable x] image%d second
- expr $second-$first
+ expr {$second-$first}
} -cleanup {
imageCleanup
} -result {1}
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index 9d6a83c..8966f1f 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -20,34 +20,34 @@ proc getTroughSize {w} {
if {[testConstraint testmetrics]} {
# Only Windows has [testmetrics]
if [string match v* [$w cget -orient]] {
- return [expr [winfo height $w] - 2*[testmetrics cyvscroll $w]]
+ return [expr {[winfo height $w] - 2*[testmetrics cyvscroll $w]}]
} else {
- return [expr [winfo width $w] - 2*[testmetrics cxhscroll $w]]
+ return [expr {[winfo width $w] - 2*[testmetrics cxhscroll $w]}]
}
} else {
if {[tk windowingsystem] eq "x11"} {
# Calculations here assume that the arrow area is a square.
if [string match v* [$w cget -orient]] {
- return [expr [winfo height $w] \
+ return [expr {[winfo height $w] \
- ([winfo width $w] \
- [$w cget -highlightthickness] \
- - [$w cget -bd] + 1)*2]
+ - [$w cget -bd] + 1)*2}]
} else {
- return [expr [winfo width $w] \
+ return [expr {[winfo width $w] \
- ([winfo height $w] \
- [$w cget -highlightthickness] \
- - [$w cget -bd] + 1)*2]
+ - [$w cget -bd] + 1)*2}]
}
} else {
# macOS aqua
if [string match v* [$w cget -orient]] {
- return [expr [winfo height $w] \
+ return [expr {[winfo height $w] \
- ([$w cget -highlightthickness] \
- +[$w cget -bd])*2]
+ +[$w cget -bd])*2}]
} else {
- return [expr [winfo width $w] \
+ return [expr {[winfo width $w] \
- ([$w cget -highlightthickness] \
- +[$w cget -bd])*2]
+ +[$w cget -bd])*2}]
}
}
}
@@ -58,8 +58,8 @@ proc getTroughSize {w} {
# as you fix bugs and add features.
foreach {width height} [wm minsize .] {
- set height [expr ($height < 200) ? 200 : $height]
- set width [expr ($width < 1) ? 1 : $width]
+ set height [expr {($height < 200) ? 200 : $height}]
+ set width [expr {($width < 1) ? 1 : $width}]
}
frame .f -height $height -width $width
@@ -233,10 +233,10 @@ test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} {
} {0}
test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 0 20]
-} [format %.6g [expr 20.0/([getTroughSize .s]-1)]]
+} [format %.6g [expr {20.0/([getTroughSize .s]-1)}]]
test scrollbar-3.27 {ScrollbarWidgetCmd procedure, "delta" option} {
format {%.6g} [.s delta 0 -20]
-} [format %.6g [expr -20.0/([getTroughSize .s]-1)]]
+} [format %.6g [expr {-20.0/([getTroughSize .s]-1)}]]
test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} {
toplevel .t -width 250 -height 100
wm geom .t +0+0
@@ -244,7 +244,7 @@ test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} {
place .t.s -width 201
update
set result [list [format {%.6g} [.t.s delta 0 20]] \
- [format {%.6g} [.t.s delta [expr [getTroughSize .t.s] - 1] 0]]]
+ [format {%.6g} [.t.s delta [expr {[getTroughSize .t.s] - 1}] 0]]]
destroy .t
set result
} {0 1}
@@ -268,22 +268,22 @@ test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} {
} {1}
test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} {
format {%.6g} [.s fraction 4 21]
-} [format %.6g [expr (21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
- /([getTroughSize .s] - 1)]]
+} [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \
+ /([getTroughSize .s] - 1)}]]
test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
format {%.6g} [.s fraction 4 179]
} {1}
test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} {
- format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s]]]
+ format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]]
} {1}
test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 {
format {%.6g} [.s fraction 4 178]
} {0.993711}
test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} {
- expr \
- [format {%.6g} [.s fraction 4 [expr 200 - [testmetrics cyvscroll .s] - 2]]] \
- == [format %g [expr (200.0 - [testmetrics cyvscroll .s]*2 - 2) \
- / ($height - 1 - [testmetrics cyvscroll .s]*2)]]
+ expr {
+ [format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s] - 2}]]]
+ == [format %g [expr {(200.0 - [testmetrics cyvscroll .s]*2 - 2)
+ / ($height - 1 - [testmetrics cyvscroll .s]*2)}]]}
} 1
toplevel .t -width 250 -height 100
@@ -297,13 +297,13 @@ test scrollbar-3.41 {ScrollbarWidgetCmd procedure, "fraction" option} {
} {0.5}
if {[testConstraint testmetrics]} {
# Only Windows has [testmetrics]
- place configure .t.s -width [expr 2*[testmetrics cxhscroll .t.s]+1]
+ place configure .t.s -width [expr {2*[testmetrics cxhscroll .t.s]+1}]
} else {
if {[tk windowingsystem] eq "x11"} {
- place configure .t.s -width [expr [winfo height .t.s] - 2*([.t.s cget -highlightthickness] + [.t.s cget -bd] + 1)]
+ place configure .t.s -width [expr {[winfo height .t.s] - 2*([.t.s cget -highlightthickness] + [.t.s cget -bd] + 1)}]
} else {
# macOS aqua
- place configure .t.s -width [expr 2*([.t.s cget -highlightthickness] + [.t.s cget -bd])]
+ place configure .t.s -width [expr {2*([.t.s cget -highlightthickness] + [.t.s cget -bd])}]
}
}
update
@@ -473,16 +473,16 @@ test scrollbar-6.6 {ScrollbarPosition procedure} unix {
.s identify 19 100
} {}
test scrollbar-6.7 {ScrollbarPosition procedure} {
- .s identify [expr [winfo width .s] / 2] -1
+ .s identify [expr {[winfo width .s] / 2}] -1
} {}
test scrollbar-6.8 {ScrollbarPosition procedure} {
- .s identify [expr [winfo width .s] / 2] [expr [winfo height .s]]
+ .s identify [expr {[winfo width .s] / 2}] [winfo height .s]
} {}
test scrollbar-6.9 {ScrollbarPosition procedure} {
- .s identify -1 [expr [winfo height .s] / 2]
+ .s identify -1 [expr {[winfo height .s] / 2}]
} {}
test scrollbar-6.10 {ScrollbarPosition procedure} {
- .s identify [winfo width .s] [expr [winfo height .s] / 2]
+ .s identify [winfo width .s] [expr {[winfo height .s] / 2}]
} {}
test scrollbar-6.11.1 {ScrollbarPosition procedure} x11 {
.s identify 8 4
@@ -499,10 +499,10 @@ test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua {
.s identify 8 19
} {trough1}
test scrollbar-6.14 {ScrollbarPosition procedure} win {
- .s identify [expr [winfo width .s] / 2] 0
+ .s identify [expr {[winfo width .s] / 2}] 0
} {arrow1}
test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] [expr [testmetrics cyvscroll .s] - 1]
+ .s identify [expr {[winfo width .s] / 2}] [expr {[testmetrics cyvscroll .s] - 1}]
} {arrow1}
test scrollbar-6.16 {ScrollbarPosition procedure} unix {
.s identify 8 20
@@ -513,11 +513,11 @@ test scrollbar-6.17 {ScrollbarPosition procedure} {unix nonPortable} {
.s identify 8 51
} {trough1}
test scrollbar-6.18 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] [testmetrics cyvscroll .s]
+ .s identify [expr {[winfo width .s] / 2}] [testmetrics cyvscroll .s]
} {trough1}
test scrollbar-6.19 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] [expr int(.2 / [.s delta 0 1]) \
- + [testmetrics cyvscroll .s] - 1]
+ .s identify [expr {[winfo width .s] / 2}] [expr {int(.2 / [.s delta 0 1])
+ + [testmetrics cyvscroll .s] - 1}]
} {trough1}
test scrollbar-6.20 {ScrollbarPosition procedure} unix {
.s identify 8 52
@@ -528,12 +528,12 @@ test scrollbar-6.21 {ScrollbarPosition procedure} {unix nonPortable} {
.s identify 8 83
} {slider}
test scrollbar-6.22 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] \
- [expr int(.2 / [.s delta 0 1] + 0.5) + [testmetrics cyvscroll .s]]
+ .s identify [expr {[winfo width .s] / 2}] \
+ [expr {int(.2 / [.s delta 0 1] + 0.5) + [testmetrics cyvscroll .s]}]
} {slider}
test scrollbar-6.23 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \
- + [testmetrics cyvscroll .s] - 1]
+ .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1])
+ + [testmetrics cyvscroll .s] - 1}]
} {slider}
test scrollbar-6.24 {ScrollbarPosition procedure} unix {
.s identify 8 84
@@ -542,12 +542,12 @@ test scrollbar-6.25 {ScrollbarPosition procedure} unix {
.s identify 8 179
} {trough2}
test scrollbar-6.27 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] [expr int(.4 / [.s delta 0 1]) \
- + [testmetrics cyvscroll .s]]
+ .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1])
+ + [testmetrics cyvscroll .s]}]
} {trough2}
test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] \
- - [testmetrics cyvscroll .s] - 1]
+ .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s]
+ - [testmetrics cyvscroll .s] - 1}]
} {trough2}
test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 {
.s identify 8 180
@@ -564,11 +564,11 @@ test scrollbar-6.30.2 {ScrollbarPosition procedure} aqua {
.s identify 8 195
} {trough2}
test scrollbar-6.32 {ScrollbarPosition procedure} {testmetrics win} {
- .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] \
- - [testmetrics cyvscroll .s]]
+ .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s]
+ - [testmetrics cyvscroll .s]}]
} {arrow2}
test scrollbar-6.33 {ScrollbarPosition procedure} win {
- .s identify [expr [winfo width .s] / 2] [expr [winfo height .s] - 1]
+ .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - 1}]
} {arrow2}
test scrollbar-6.34 {ScrollbarPosition procedure} unix {
.s identify 4 100
@@ -580,7 +580,7 @@ test scrollbar-6.37 {ScrollbarPosition procedure} win {
.s identify 0 100
} {trough2}
test scrollbar-6.38 {ScrollbarPosition procedure} win {
- .s identify [expr [winfo width .s] - 1] 100
+ .s identify [expr {[winfo width .s] - 1}] 100
} {trough2}
catch {destroy .t}
@@ -599,7 +599,7 @@ test scrollbar-6.39.2 {ScrollbarPosition procedure} aqua {
.t.s identify 4 8
} {trough1}
test scrollbar-6.40 {ScrollbarPosition procedure} win {
- .t.s identify 0 [expr [winfo height .t.s] / 2]
+ .t.s identify 0 [expr {[winfo height .t.s] / 2}]
} {arrow1}
test scrollbar-6.41.1 {ScrollbarPosition procedure} x11 {
.t.s identify 82 8
@@ -609,14 +609,14 @@ test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua {
.t.s identify 82 8
} {trough2}
test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} {
- .t.s identify [expr int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] \
- - 1] [expr [winfo height .t.s] / 2]
+ .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s]
+ - 1}] [expr {[winfo height .t.s] / 2}]
} {slider}
test scrollbar-6.44 {ScrollbarPosition procedure} unix {
.t.s identify 100 18
} {trough2}
test scrollbar-6.46 {ScrollbarPosition procedure} win {
- .t.s identify 100 [expr [winfo height .t.s] - 1]
+ .t.s identify 100 [expr {[winfo height .t.s] - 1}]
} {trough2}
test scrollbar-7.1 {EventuallyRedraw} {
@@ -645,7 +645,7 @@ test scrollbar-8.1 {TkScrollbarEventProc: recursive deletion} notAqua {
.t.f.s set 0 .5
update
set result [winfo exists .t.f.s]
- event generate .t.f.s <ButtonPress> -button 1 -x [expr [winfo width .t.f.s] / 2] -y 5
+ event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
event generate .t <ButtonRelease> -button 1
update
lappend result [winfo exists .t.f.s] [winfo exists .t.f]
@@ -666,7 +666,7 @@ test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} notAqua {
.t.f.s set 0 .5
update
set result [winfo exists .t.f.s]
- event generate .t.f.s <ButtonPress> -button 1 -x [expr [winfo width .t.f.s] / 2] -y 5
+ event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5
event generate .t.f <ButtonRelease> -button 1
update
lappend result [winfo exists .t.f.s] [winfo exists .t.f]
diff --git a/tests/select.test b/tests/select.test
index 5949b9c..f89a736 100644
--- a/tests/select.test
+++ b/tests/select.test
@@ -36,7 +36,7 @@ proc handler {type offset count} {
if {$numBytes <= 0} {
return ""
}
- string range $selValue $offset [expr $numBytes+$offset]
+ string range $selValue $offset [expr {$numBytes+$offset}]
}
proc errIncrHandler {type offset count} {
@@ -55,7 +55,7 @@ proc errIncrHandler {type offset count} {
if {$numBytes <= 0} {
return ""
}
- string range $selValue $offset [expr $numBytes+$offset]
+ string range $selValue $offset [expr {$numBytes+$offset}]
}
proc errHandler args {
@@ -70,7 +70,7 @@ proc badHandler {path type offset count} {
if {$numBytes <= 0} {
return ""
}
- string range $selValue $offset [expr $numBytes+$offset]
+ string range $selValue $offset [expr {$numBytes+$offset}]
}
proc reallyBadHandler {path type offset count} {
global selValue selInfo pass
@@ -86,7 +86,7 @@ proc reallyBadHandler {path type offset count} {
if {$numBytes <= 0} {
return ""
}
- string range $selValue $offset [expr $numBytes+$offset]
+ string range $selValue $offset [expr {$numBytes+$offset}]
}
# Eliminate any existing selection on the screen. This is needed in case
@@ -1147,7 +1147,7 @@ test select-13.1 {SelectionSize procedure, handler deleted} -constraints {
if {$numBytes <= 0} {
return ""
}
- string range $selValue $offset [expr $numBytes+$offset]
+ string range $selValue $offset [expr {$numBytes+$offset}]
}
set selValue $longValue
set selInfo ""
diff --git a/tests/text.test b/tests/text.test
index be25ca6..5b2d7e3 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -2686,7 +2686,7 @@ test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
set res {}
} -body {
for {set i 1} {$i < 5} {incr i} {
- .t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n"
+ .t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr {64+$i}]]\n"
}
.t tag configure hidden -elide true
.t tag add hidden 2.15 3.10
@@ -2708,7 +2708,7 @@ test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup {
for {set i 1} {$i < 5} {incr i} {
# 0 1 2 3 4
# 012345 678901234 567890123 456789012 34567890123456789
- .mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n"
+ .mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr {64+$i}]]\n"
}
.mytop.t tag configure hidden -elide true
.mytop.t tag add hidden 2.30 3.10
@@ -6133,9 +6133,9 @@ test text-23.4 {TkTextGetTabs procedure} -setup {
.t insert end "1\t2\t3\t4\t55.5"
.t configure -tabs {100 right 200 left 300 center 400 numeric}
update idletasks
- list [expr [lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]] \
+ list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \
[lindex [.t bbox 1.4] 0] \
- [expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2] \
+ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \
[lindex [.t bbox 1.10] 0]
} -cleanup {
destroy .t
@@ -6147,9 +6147,9 @@ test text-23.5 {TkTextGetTabs procedure} -setup {
.t insert end "1\t2\t3\t4\t55.5"
.t configure -tabs {105 r 205 l 305 c 405 n}
update idletasks
- list [expr [lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]] \
+ list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \
[lindex [.t bbox 1.4] 0] \
- [expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2] \
+ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \
[lindex [.t bbox 1.10] 0]
} -cleanup {
destroy .t
diff --git a/tests/textBTree.test b/tests/textBTree.test
index ebd6c50..fd97afa 100644
--- a/tests/textBTree.test
+++ b/tests/textBTree.test
@@ -422,8 +422,8 @@ test btree-6.5 {very large deletes, with tags} -setup {
setup
.t insert 1.1 $bigText2
for {set i 0} {$i < 100} {incr i} {
- set j [expr $i+2]
- set k [expr 1+2*$i]
+ set j [expr {$i+2}]
+ set k [expr {1+2*$i}]
.t tag add x $j.1 $j.3
.t tag add y $k.1 $k.6
}
@@ -439,13 +439,13 @@ test btree-6.6 {very large deletes, with tags} -setup {
setup
.t insert 1.1 $bigText2
for {set i 0} {$i < 100} {incr i} {
- set j [expr $i+2]
- set k [expr 1+2*$i]
+ set j [expr {$i+2}]
+ set k [expr {1+2*$i}]
.t tag add x $j.1 $j.3
.t tag add y $k.1 $k.6
}
for {set i 199} {$i >= 2} {incr i -1} {
- .t delete $i.0 [expr $i+1].0
+ .t delete $i.0 [expr {$i+1}].0
}
list [.t tag ranges x] [.t tag ranges y]
} -result {{3.0 3.1 3.4 3.12 4.2 4.6} {1.1 1.6 3.4 3.5}}
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 208f664..7245e91 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -230,7 +230,7 @@ test textDisp-2.1 {LayoutDLine, basics} {
.t delete 1.0 end
.t insert 1.0 "This is some sample text for testing."
list [.t bbox 1.19] [.t bbox 1.20]
-} [list [list [expr 5 + $fixedWidth * 19] 5 $fixedWidth $fixedHeight] [list 5 [expr 5 + $fixedHeight] $fixedWidth $fixedHeight]]
+} [list [list [expr {5 + $fixedWidth * 19}] 5 $fixedWidth $fixedHeight] [list 5 [expr {5 + $fixedHeight}] $fixedWidth $fixedHeight]]
test textDisp-2.2 {LayoutDLine, basics} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
@@ -274,7 +274,7 @@ foreach m [.t mark names] {
}
scan [wm geom .] %dx%d width height
test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {textfonts} {
- wm geom . [expr $width+1]x$height
+ wm geom . [expr {$width+1}]x$height
update
.t configure -wrap char
.t delete 1.0 end
@@ -414,22 +414,22 @@ test textDisp-2.22 {LayoutDLine, spacing options} {textfonts} {
.t insert end "to wrap around a couple of times"
.t insert end "\nLine 3\nLine 4"
set i [.t dlineinfo 1.0]
- set b1 [expr [lindex $i 1] + [lindex $i 4]]
+ set b1 [expr {[lindex $i 1] + [lindex $i 4]}]
set i [.t dlineinfo 2.0]
- set b2 [expr [lindex $i 1] + [lindex $i 4]]
+ set b2 [expr {[lindex $i 1] + [lindex $i 4]}]
set i [.t dlineinfo 2.end]
- set b3 [expr [lindex $i 1] + [lindex $i 4]]
+ set b3 [expr {[lindex $i 1] + [lindex $i 4]}]
set i [.t dlineinfo 3.0]
- set b4 [expr [lindex $i 1] + [lindex $i 4]]
+ set b4 [expr {[lindex $i 1] + [lindex $i 4]}]
.t configure -spacing1 2 -spacing2 1 -spacing3 3
set i [.t dlineinfo 1.0]
- set b1 [expr [lindex $i 1] + [lindex $i 4] - $b1]
+ set b1 [expr {[lindex $i 1] + [lindex $i 4] - $b1}]
set i [.t dlineinfo 2.0]
- set b2 [expr [lindex $i 1] + [lindex $i 4] - $b2]
+ set b2 [expr {[lindex $i 1] + [lindex $i 4] - $b2}]
set i [.t dlineinfo 2.end]
- set b3 [expr [lindex $i 1] + [lindex $i 4] - $b3]
+ set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}]
set i [.t dlineinfo 3.0]
- set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
+ set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}]
list $b1 $b2 $b3 $b4
} [list 2 7 10 15]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
@@ -441,13 +441,13 @@ test textDisp-2.23 {LayoutDLine, spacing options} {textfonts} {
.t insert end "to wrap around a couple of times"
.t insert end "\nLine 3\nLine 4"
set i [.t dlineinfo 1.0]
- set b1 [expr [lindex $i 1] + [lindex $i 4]]
+ set b1 [expr {[lindex $i 1] + [lindex $i 4]}]
set i [.t dlineinfo 2.0]
- set b2 [expr [lindex $i 1] + [lindex $i 4]]
+ set b2 [expr {[lindex $i 1] + [lindex $i 4]}]
set i [.t dlineinfo 2.end]
- set b3 [expr [lindex $i 1] + [lindex $i 4]]
+ set b3 [expr {[lindex $i 1] + [lindex $i 4]}]
set i [.t dlineinfo 3.0]
- set b4 [expr [lindex $i 1] + [lindex $i 4]]
+ set b4 [expr {[lindex $i 1] + [lindex $i 4]}]
.t configure -spacing1 4 -spacing2 4 -spacing3 4
.t tag configure x -spacing1 1 -spacing2 2 -spacing3 3
.t tag add x 1.0 end
@@ -455,13 +455,13 @@ test textDisp-2.23 {LayoutDLine, spacing options} {textfonts} {
.t tag add y 2.19 end
.t tag raise y
set i [.t dlineinfo 1.0]
- set b1 [expr [lindex $i 1] + [lindex $i 4] - $b1]
+ set b1 [expr {[lindex $i 1] + [lindex $i 4] - $b1}]
set i [.t dlineinfo 2.0]
- set b2 [expr [lindex $i 1] + [lindex $i 4] - $b2]
+ set b2 [expr {[lindex $i 1] + [lindex $i 4] - $b2}]
set i [.t dlineinfo 2.end]
- set b3 [expr [lindex $i 1] + [lindex $i 4] - $b3]
+ set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}]
set i [.t dlineinfo 3.0]
- set b4 [expr [lindex $i 1] + [lindex $i 4] - $b4]
+ set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}]
list $b1 $b2 $b3 $b4
} [list 1 5 13 16]
.t configure -spacing1 0 -spacing2 0 -spacing3 0
@@ -1343,7 +1343,7 @@ test textDisp-9.13 {TkTextRedrawTag} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 10} {incr i} {
- .t insert end "Line $i - This is Line [format %c [expr 64+$i]]\n"
+ .t insert end "Line $i - This is Line [format %c [expr {64+$i}]]\n"
}
.t tag add hidden 2.8 2.17
.t tag add hidden 6.8 7.17
@@ -1514,7 +1514,7 @@ test textDisp-11.13 {TkTestSetYView, partially visible last line} {
}
update
scan [wm geometry .top] "%dx%d" w2 h2
- wm geometry .top ${w2}x[expr $h2-2]
+ wm geometry .top ${w2}x[expr {$h2-2}]
update
.top.t yview 1.0
update
@@ -1745,7 +1745,7 @@ test textDisp-13.8 {TkTextSeeCmd procedure} {textfonts} {
lappend x [.t bbox 30.90]
} [list [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight]]
test textDisp-13.9 {TkTextSeeCmd procedure} {textfonts} {
- wm geom . [expr $width-2]x$height
+ wm geom . [expr {$width-2}]x$height
.t xview moveto 0
.t yview moveto 0
.t tag add sel 30.20
@@ -2136,7 +2136,7 @@ test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {
.t yview 98.0
update
.t yview scroll 1 page
- set res [expr int([.t index @0,0])]
+ set res [expr {int([.t index @0,0])}]
if {$fixedDiff > 1} {
incr res -1
}
@@ -2292,7 +2292,7 @@ test textDisp-16.44 {TkTextYviewCmd procedure, scroll down, with elided lines} {
}
.t tag configure hidden -elide true ; # 5 hidden lines
update
- .t see [expr {5 + [winfo height .t] / $fixedHeight} + 1].0
+ .t see [expr {5 + [winfo height .t] / $fixedHeight + 1}].0
update
.t index @0,0
} {2.0}
@@ -2743,7 +2743,7 @@ test textDisp-19.12 {GetYView procedure, partially visible last line} {
# Need to wait for asychronous calculations to complete.
update ; after 10
scan [wm geom .top] %dx%d twidth theight
- wm geom .top ${twidth}x[expr $theight - 3]
+ wm geom .top ${twidth}x[expr {$theight - 3}]
update
.top.t yview
} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
@@ -2757,7 +2757,7 @@ test textDisp-19.13 {GetYView procedure, partially visible last line} {textfonts
# Need to wait for asychronous calculations to complete.
update ; after 10
scan [wm geom .top] %dx%d twidth theight
- wm geom .top ${twidth}x[expr $theight - 3]
+ wm geom .top ${twidth}x[expr {$theight - 3}]
update
.top.t yview
} [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]]
@@ -2992,21 +2992,21 @@ test textDisp-22.2 {TkTextCharBbox} {textfonts} {
test textDisp-22.3 {TkTextCharBbox, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
- wm geom . ${width}x[expr $height-1]
+ wm geom . ${width}x[expr {$height-1}]
update
list [.t bbox 19.1] [.t bbox 20.1]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 3]]
test textDisp-22.4 {TkTextCharBbox, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
- wm geom . ${width}x[expr $height+1]
+ wm geom . ${width}x[expr {$height+1}]
update
list [.t bbox 19.1] [.t bbox 20.1]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 5]]
test textDisp-22.5 {TkTextCharBbox, cut-off char} {textfonts} {
.t config -wrap none
.t yview 10.0
- wm geom . [expr $width-95]x$height
+ wm geom . [expr {$width-95}]x$height
update
.t bbox 15.6
} [list 45 [expr {3+5*$fixedHeight}] 7 $fixedHeight]
@@ -3014,7 +3014,7 @@ test textDisp-22.6 {TkTextCharBbox, line visible but not char} {textfonts} {
.t config -wrap char
.t yview 10.0
.t tag add big 20.2 20.5
- wm geom . ${width}x[expr $height+3]
+ wm geom . ${width}x[expr {$height+3}]
update
list [.t bbox 19.1] [.t bbox 20.1] [.t bbox 20.2]
} [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] {} [list 17 [expr {3+10*$fixedHeight}] 14 7]]
@@ -3060,7 +3060,7 @@ test textDisp-22.10 {TkTextCharBbox, handling of elided lines} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
for {set i 1} {$i < 10} {incr i} {
- .t insert end "Line $i - Line [format %c [expr 64+$i]]\n"
+ .t insert end "Line $i - Line [format %c [expr {64+$i}]]\n"
}
.t tag add hidden 2.8 2.13
.t tag add hidden 6.8 7.13
@@ -3083,7 +3083,7 @@ test textDisp-22.11 {TkTextCharBbox, handling of wrapped elided lines} {textfont
.t configure -wrap char
.t delete 1.0 end
for {set i 1} {$i < 10} {incr i} {
- .t insert end "Line $i - Line _$i - Lines .$i - Line [format %c [expr 64+$i]]\n"
+ .t insert end "Line $i - Line _$i - Lines .$i - Line [format %c [expr {64+$i}]]\n"
}
.t tag add hidden 1.30 2.5
.t tag configure hidden -elide true
@@ -3124,14 +3124,14 @@ test textDisp-23.3 {TkTextDLineInfo} {textfonts} {
test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
- wm geom . ${width}x[expr $height-1]
+ wm geom . ${width}x[expr {$height-1}]
update
list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 3 [expr {$fixedDiff + 10}]]]
test textDisp-23.5 {TkTextDLineInfo, cut-off lines} {textfonts} {
.t config -wrap char
.t yview 10.0
- wm geom . ${width}x[expr $height+1]
+ wm geom . ${width}x[expr {$height+1}]
update
list [.t dlineinfo 19.0] [.t dlineinfo 20.0]
} [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 5 [expr {$fixedDiff + 10}]]]
@@ -3172,7 +3172,7 @@ test textDisp-24.2 {TkTextCharLayoutProc} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
- wm geom . [expr $width+1]x$height
+ wm geom . [expr {$width+1}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
@@ -3180,7 +3180,7 @@ test textDisp-24.3 {TkTextCharLayoutProc} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
- wm geom . [expr $width-1]x$height
+ wm geom . [expr {$width-1}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
@@ -3212,7 +3212,7 @@ test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
- wm geom . [expr $width+1]x$height
+ wm geom . [expr {$width+1}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
@@ -3220,7 +3220,7 @@ test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
- wm geom . [expr $width-1]x$height
+ wm geom . [expr {$width-1}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
@@ -3228,7 +3228,7 @@ test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
- wm geom . [expr $width-6]x$height
+ wm geom . [expr {$width-6}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 5 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
@@ -3236,7 +3236,7 @@ test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "a b c d e f g h i j k l m n o p"
- wm geom . [expr $width-7]x$height
+ wm geom . [expr {$width-7}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 4 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
@@ -3244,7 +3244,7 @@ test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't qui
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "01234567890123456789 \nabcdefg"
- wm geom . [expr $width-2]x$height
+ wm geom . [expr {$width-2}]x$height
update
set result {}
lappend result [.t bbox 1.21] [.t bbox 2.0]
@@ -3271,7 +3271,7 @@ test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
- wm geom . [expr $width+1]x$height
+ wm geom . [expr {$width+1}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 143 3 5 $fixedHeight]]
@@ -3279,7 +3279,7 @@ test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
.t insert 1.0 "abcdefghijklmnopqrstuvwxyz"
- wm geom . [expr $width-1]x$height
+ wm geom . [expr {$width-1}]x$height
update
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 143 3 3 $fixedHeight]]
@@ -3428,9 +3428,9 @@ test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} {
.t tag configure x -tabs {40 70 right}
.t tag add x 1.0 end
list [lindex [.t bbox 1.2] 0] \
- [expr [lindex [.t bbox 1.4] 0] + [lindex [.t bbox 1.4] 2]] \
- [expr [lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]] \
- [expr [lindex [.t bbox 1.8] 0] + [lindex [.t bbox 1.8] 2]]
+ [expr {[lindex [.t bbox 1.4] 0] + [lindex [.t bbox 1.4] 2]}] \
+ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]}] \
+ [expr {[lindex [.t bbox 1.8] 0] + [lindex [.t bbox 1.8] 2]}]
} [list 40 70 100 130]
test textDisp-26.4 {AdjustForTab procedure, different alignments} {
.t delete 1.0 end
diff --git a/tests/textTag.test b/tests/textTag.test
index 9bab5fb..5761abc 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -1477,14 +1477,14 @@ test textTag-14.4 {SortTags} -constraints haveCourier12 -setup {
set c [.t bbox 2.1]
-set x1 [expr [lindex $c 0] + [lindex $c 2]/2]
-set y1 [expr [lindex $c 1] + [lindex $c 3]/2]
+set x1 [expr {[lindex $c 0] + [lindex $c 2]/2}]
+set y1 [expr {[lindex $c 1] + [lindex $c 3]/2}]
set c [.t bbox 3.2]
-set x2 [expr [lindex $c 0] + [lindex $c 2]/2]
-set y2 [expr [lindex $c 1] + [lindex $c 3]/2]
+set x2 [expr {[lindex $c 0] + [lindex $c 2]/2}]
+set y2 [expr {[lindex $c 1] + [lindex $c 3]/2}]
set c [.t bbox 4.3]
-set x3 [expr [lindex $c 0] + [lindex $c 2]/2]
-set y3 [expr [lindex $c 1] + [lindex $c 3]/2]
+set x3 [expr {[lindex $c 0] + [lindex $c 2]/2}]
+set y3 [expr {[lindex $c 1] + [lindex $c 3]/2}]
test textTag-15.1 {TkTextBindProc} -constraints haveCourier12 -setup {
.t tag delete x y
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index 8414ae3..43a6527 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -683,8 +683,8 @@ test treeview-368fa4561e "indicators cannot be clicked on leafs" -setup {
# using $h even for x computation is intentional here in order to simulate
# a mouse click on the (invisible since we're on a leaf) indicator
event generate .tv <ButtonPress-1> \
- -x [expr ($x + $h / 2)] \
- -y [expr ($y + $h / 2)]
+ -x [expr {$x + $h / 2}] \
+ -y [expr {$y + $h / 2}]
lappend res [.tv item foo -open]
.tv insert foo end -text "sub"
lappend res [.tv item foo -open]
diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test
index e58b021..a1560b4 100644
--- a/tests/ttk/ttk.test
+++ b/tests/ttk/ttk.test
@@ -269,7 +269,7 @@ test ttk-3.4 "SF#2009213" -body {
test ttk-4.0 "Setup" -body {
catch { destroy .t }
pack [ttk::label .t -text "Button 1"]
- testConstraint fontOption [expr ![catch { set prevFont [.t cget -font] }]]
+ testConstraint fontOption [expr {![catch { set prevFont [.t cget -font] }]}]
ok
}
diff --git a/tests/visual.test b/tests/visual.test
index 2f5c34a..13d6fd2 100644
--- a/tests/visual.test
+++ b/tests/visual.test
@@ -29,9 +29,9 @@ proc eatColors {w} {
pack $w.c
for {set y 0} {$y < 8} {incr y} {
for {set x 0} {$x < 40} {incr x} {
- set color [format #%02x%02x%02x [expr $x*6] [expr $y*30] 0]
- $w.c create rectangle [expr 10*$x] [expr 20*$y] \
- [expr 10*$x + 10] [expr 20*$y + 20] -outline {} \
+ set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0]
+ $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \
+ [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \
-fill $color
}
}
@@ -50,8 +50,8 @@ proc eatColors {w} {
proc colorsFree {w {red 31} {green 245} {blue 192}} {
set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]]
- expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \
- && ([lindex $vals 2]/256 == $blue)
+ expr {([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green)
+ && ([lindex $vals 2]/256 == $blue)}
}
# If more than one visual type is available for the screen, pick one
diff --git a/tests/winFont.test b/tests/winFont.test
index 8039426..377ef41 100644
--- a/tests/winFont.test
+++ b/tests/winFont.test
@@ -180,7 +180,7 @@ test winfont-5.3 {Tk_MeasureChars procedure: all chars did fit} -constraints {
set ax [winfo reqwidth .t.l]
set ay [winfo reqheight .t.l]
- .t.l config -wrap [expr $ax*10] -text "00000000"
+ .t.l config -wrap [expr {$ax*10}] -text "00000000"
list [expr {[winfo reqwidth .t.l] eq 8*$ax}] \
[expr {[winfo reqheight .t.l] eq $ay}]
} -cleanup {
@@ -199,7 +199,7 @@ test winfont-5.4 {Tk_MeasureChars procedure: not all chars fit} -constraints {
set ax [winfo reqwidth .t.l]
set ay [winfo reqheight .t.l]
- .t.l config -wrap [expr $ax*6] -text "00000000"
+ .t.l config -wrap [expr {$ax*6}] -text "00000000"
list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \
[expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
@@ -218,7 +218,7 @@ test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} -constra
.t.c dchars $t 0 end
.t.c insert $t 0 "0000"
- .t.c index $t @[expr int($cx*2.5)],1
+ .t.c index $t @[expr {int($cx*2.5)}],1
} -cleanup {
destroy .t.c
} -result {2}
@@ -254,7 +254,7 @@ test winfont-5.7 {Tk_MeasureChars procedure: whole words} -constraints {
set ax [winfo reqwidth .t.l]
set ay [winfo reqheight .t.l]
- .t.l config -wrap [expr $ax*8] -text "000000 0000"
+ .t.l config -wrap [expr {$ax*8}] -text "000000 0000"
list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \
[expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
@@ -273,7 +273,7 @@ test winfont-5.8 {Tk_MeasureChars procedure: already saw space in line} -constra
set ax [winfo reqwidth .t.l]
set ay [winfo reqheight .t.l]
- .t.l config -wrap [expr $ax*12] -text "000000 0000000"
+ .t.l config -wrap [expr {$ax*12}] -text "000000 0000000"
list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \
[expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
@@ -292,7 +292,7 @@ test winfont-5.9 {Tk_MeasureChars procedure: internal spaces significant} -const
set ax [winfo reqwidth .t.l]
set ay [winfo reqheight .t.l]
- .t.l config -wrap [expr $ax*12] -text "000 00 00000"
+ .t.l config -wrap [expr {$ax*12}] -text "000 00 00000"
list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \
[expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
@@ -311,7 +311,7 @@ test winfont-5.10 {Tk_MeasureChars procedure: make first part of word fit} -cons
set ax [winfo reqwidth .t.l]
set ay [winfo reqheight .t.l]
- .t.l config -wrap [expr $ax*12] -text "0000000000000000"
+ .t.l config -wrap [expr {$ax*12}] -text "0000000000000000"
list [expr {[winfo reqwidth .t.l] eq 12*$ax}] \
[expr {[winfo reqheight .t.l] eq 2*$ay}]
} -cleanup {
@@ -334,7 +334,7 @@ test winfont-5.11 {Tk_MeasureChars procedure: check for kerning} -constraints {
.t.l config -text "XaYoYaKaWx"
set x [lindex [getsize] 0]
.t.l config -font $font
- expr $x < ($width*10)
+ expr {$x < ($width*10)}
} -cleanup {
destroy .t.l
} -result {1}
diff --git a/tests/winSend.test b/tests/winSend.test
index 0f3baf8..31c800e 100644
--- a/tests/winSend.test
+++ b/tests/winSend.test
@@ -118,8 +118,8 @@ test winSend-2.3 {Tk_SendObjCmd - sending to ourselves in a different interprete
} {0 b {}}
test winSend-2.4 {Tk_SendObjCmd - sending to ourselves in a different interp with errors} winSend {
newApp testApp
- list [catch {send testApp {expr 2 / 0}} msg] $msg $errorCode $errorInfo [interp delete testApp]
-} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n while executing\n\"expr 2 / 0\"\n invoked from within\n\"send testApp {expr 2 / 0}\"} {}"
+ list [catch {send testApp {expr {2 / 0}}} msg] $msg $errorCode $errorInfo [interp delete testApp]
+} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n while executing\n\"expr {2 / 0}\"\n invoked from within\n\"send testApp {expr {2 / 0}}\"} {}"
test winSend-2.5 {Tk_SendObjCmd - sending to another app async} winSend {
set newInterps [winfo interps]
foreach interp $newInterps {
@@ -145,8 +145,8 @@ test winSend-2.7 {Tk_SendObjCmd - sending to another app - error} winSend {
break
}
}
- list [catch {send $interp {expr 2 / 0}} msg] $msg $errorCode $errorInfo
-} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n while executing\n\"expr 2 / 0\"\n invoked from within\n\"send \$interp {expr 2 / 0}\"}"
+ list [catch {send $interp {expr {2 / 0}}} msg] $msg $errorCode $errorInfo
+} "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n while executing\n\"expr {2 / 0}\"\n invoked from within\n\"send \$interp {expr {2 / 0}}\"}"
test winSend-3.1 {TkGetInterpNames} winSend {
set origLength [llength $currentInterps]
@@ -170,7 +170,7 @@ test winSend-5.1 {ExecuteRemoteObject - no error} winSend {
break
}
}
- list [send $interp {send [tk appname] {expr 2 / 1}}]
+ list [send $interp {send [tk appname] {expr {2 / 1}}}]
} {2}
test winSend-5.2 {ExecuteRemoteObject - error} winSend {
set newInterps [winfo interps]
@@ -179,7 +179,7 @@ test winSend-5.2 {ExecuteRemoteObject - error} winSend {
break
}
}
- list [catch {send $interp {send [tk appname] {expr 2 / 0}}} msg] $msg
+ list [catch {send $interp {send [tk appname] {expr {2 / 0}}}} msg] $msg
} {1 {divide by zero}}
test winSend-6.1 {SendDDEServer - XTYP_CONNECT} winSend {
@@ -246,7 +246,7 @@ test winSend-6.6 {SendDDEServer - XTYP_REQUEST return results} winSend {
break
}
}
- set command "send [tk appname] {expr $foo + 1}"
+ set command "send [tk appname] {expr {$foo + 1}}"
list [catch "send \{$interp\} \{$command\}" msg] $msg
} {0 4}
test winSend-6.7 {SendDDEServer - XTYP_EXECUTE} winSend {
@@ -256,7 +256,7 @@ test winSend-6.7 {SendDDEServer - XTYP_EXECUTE} winSend {
break
}
}
- set command "send [tk appname] {expr 4 / 2}"
+ set command "send [tk appname] {expr {4 / 2}}"
list [catch "send \{$interp\} \{$command\}" msg] $msg
} {0 2}
test winSend-6.8 {SendDDEServer - XTYP_WILDCONNECT} winSend {
@@ -386,7 +386,7 @@ test winSend-10.17 {Tk_DDEObjCmd - valid variable} winSend {
} {0 winSend-10.17}
test winSend-10.18 {Tk_DDEObjCmd - services} winSend {
set currentService [list Tk [tk appname]]
- list [catch {dde services Tk {}} msg] [expr [lsearch $msg $currentService] >= 0]
+ list [catch {dde services Tk {}} msg] [expr {[lsearch $msg $currentService] >= 0}]
} {0 1}
# Get rid of the other app and all of its interps
diff --git a/tests/winfo.test b/tests/winfo.test
index 83aff71..49a92a6 100644
--- a/tests/winfo.test
+++ b/tests/winfo.test
@@ -27,9 +27,9 @@ proc eatColors {w {options ""}} {
pack $w.c
for {set y 0} {$y < 8} {incr y} {
for {set x 0} {$x < 40} {incr x} {
- set color [format #%02x%02x%02x [expr $x*6] [expr $y*30] 0]
- $w.c create rectangle [expr 10*$x] [expr 20*$y] \
- [expr 10*$x + 10] [expr 20*$y + 20] -outline {} \
+ set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0]
+ $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \
+ [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \
-fill $color
}
}
@@ -156,7 +156,7 @@ test winfo-4.6 {"winfo containing" command} -constraints {
wm geom .t +0+0
update
- winfo containing [expr [winfo rootx .t.f]-1] [expr [winfo rooty .t.f]-1]
+ winfo containing [expr {[winfo rootx .t.f]-1}] [expr {[winfo rooty .t.f]-1}]
} -cleanup {
destroy .t
} -result .t
@@ -169,8 +169,8 @@ test winfo-4.7 {"winfo containing" command} -setup {
wm geom .t +0+0
update
- set x [winfo containing -display .t.f [expr [winfo rootx .t]+600] \
- [expr [winfo rooty .t.f]+450]]
+ set x [winfo containing -display .t.f [expr {[winfo rootx .t]+600}] \
+ [expr {[winfo rooty .t.f]+450}]]
expr {($x == ".") || ($x == "")}
} -cleanup {
destroy .t
@@ -364,7 +364,7 @@ test winfo-11.5 {"winfo visualid" command} -body {
} -result {3}
test winfo-11.6 {"winfo visualid" command} -body {
set x [lindex [lindex [winfo visualsa . includeids] 0] 2]
- expr $x + 2 - $x
+ expr {$x + 2 - $x}
} -result {2}