summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-14 07:36:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-14 07:36:16 (GMT)
commit075429fc2cc7afc986bc3839feacf935c89ccbc7 (patch)
tree974fdecf07326f588f07e04256d91c98b2fde350 /tests
parent26d2f8ec042c3a1c076a64a8651aa88294ff6a0f (diff)
downloadtk-075429fc2cc7afc986bc3839feacf935c89ccbc7.zip
tk-075429fc2cc7afc986bc3839feacf935c89ccbc7.tar.gz
tk-075429fc2cc7afc986bc3839feacf935c89ccbc7.tar.bz2
Use consistant $idx < 0 in stead of $idx != -1 for checking index meaning 'not found'
Diffstat (limited to 'tests')
-rw-r--r--tests/color.test2
-rw-r--r--tests/imgBmap.test4
-rw-r--r--tests/imgPhoto.test4
-rw-r--r--tests/textWind.test2
-rw-r--r--tests/tk.test2
-rw-r--r--tests/ttk/vsapi.test2
6 files changed, 8 insertions, 8 deletions
diff --git a/tests/color.test b/tests/color.test
index 4cdaf23..2fd09d2 100644
--- a/tests/color.test
+++ b/tests/color.test
@@ -162,7 +162,7 @@ test color-1.4 {Tk_AllocColorFromObj - try other colors in list} colorsFree {
test color-1.5 {Color table} nonPortable {
set fd [open ../xlib/rgb.txt]
set result {}
- while {[gets $fd line] != -1} {
+ while {[gets $fd line] >= 0} {
if {[string index $line 0] == "!"} continue
set rgb [c255 [winfo rgb . [lrange $line 3 end]]]
if {$rgb != [lrange $line 0 2] } {
diff --git a/tests/imgBmap.test b/tests/imgBmap.test
index a2ebdfa..8da1742 100644
--- a/tests/imgBmap.test
+++ b/tests/imgBmap.test
@@ -503,8 +503,8 @@ test imageBmap-11.2 {ImgBmapDelete procedure} -body {
test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} -body {
image create bitmap i2 -file foo.bm -maskfile foo2.bm
rename i2 {}
- list [lsearch -exact [imageNames] i2] [catch {i2 foo} msg] $msg
-} -result {-1 1 {invalid command name "i2"}}
+ list [expr {i2 in [imageNames]}] [catch {i2 foo} msg] $msg
+} -result {0 1 {invalid command name "i2"}}
removeFile foo.bm
removeFile foo2.bm
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index 3c4c7a5..7767690 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -952,8 +952,8 @@ test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints {
} -body {
image create photo photo2 -file $teapotPhotoFile
rename photo2 {}
- list [lsearch -exact [imageNames] photo2] [catch {photo2 foo} msg] $msg
-} -result {-1 1 {invalid command name "photo2"}}
+ list [expr {photo2 in [imageNames]}] [catch {photo2 foo} msg] $msg
+} -result {0 1 {invalid command name "photo2"}}
test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup {
imageCleanup
diff --git a/tests/textWind.test b/tests/textWind.test
index db75c68..f2b5703 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -773,7 +773,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
.t delete 1.0 end
proc bgerror args {
global msg
- if {[lsearch -exact $msg $args] == -1} {
+ if {[lsearch -exact $msg $args] < 0} {
lappend msg $args
}
}
diff --git a/tests/tk.test b/tests/tk.test
index 748a6cf..30a36d9 100644
--- a/tests/tk.test
+++ b/tests/tk.test
@@ -157,7 +157,7 @@ test tk-6.5 {tk inactive} -body {
update
after 100
set i [tk inactive]
- expr {$i == -1 || ( $i > 90 && $i < 200 )}
+ expr {$i < 0 || ( $i > 90 && $i < 200 )}
} -result 1
test tk-7.1 {tk inactive in a safe interpreter} -body {
diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test
index bb88fef..3966bd9 100644
--- a/tests/ttk/vsapi.test
+++ b/tests/ttk/vsapi.test
@@ -6,7 +6,7 @@ package require tcltest ; namespace import -force tcltest::*
loadTestedCommands
testConstraint xpnative \
- [expr {[lsearch -exact [ttk::style theme names] xpnative] != -1}]
+ [expr {"xpnative" in [ttk::style theme names]}]
test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints {xpnative} -body {
ttk::style element create smallclose vsapi \