diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-14 09:22:18 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-14 09:22:18 (GMT) |
commit | f0ec68f07293dac2b967d45a3697073b77688970 (patch) | |
tree | 1c2e9c90480d43aa230b77653baff036339dc848 /tests | |
parent | 6e44927248852ae0356d9d3e1cfa3d69597a66b1 (diff) | |
download | tcl-f0ec68f07293dac2b967d45a3697073b77688970.zip tcl-f0ec68f07293dac2b967d45a3697073b77688970.tar.gz tcl-f0ec68f07293dac2b967d45a3697073b77688970.tar.bz2 |
Prevent the usage of the term safe/unsafe child. Suggested by Keith Nash. Thanks!
More usage of $index<0 in stead of $index==-1 consistantly
Diffstat (limited to 'tests')
-rw-r--r-- | tests/chan.test | 2 | ||||
-rw-r--r-- | tests/http11.test | 2 | ||||
-rw-r--r-- | tests/httpTest.tcl | 12 | ||||
-rw-r--r-- | tests/httpd11.tcl | 2 | ||||
-rw-r--r-- | tests/obj.test | 2 | ||||
-rw-r--r-- | tests/reg.test | 8 | ||||
-rw-r--r-- | tests/socket.test | 2 | ||||
-rw-r--r-- | tests/stringObj.test | 4 | ||||
-rw-r--r-- | tests/thread.test | 4 | ||||
-rw-r--r-- | tests/unload.test | 4 |
10 files changed, 21 insertions, 21 deletions
diff --git a/tests/chan.test b/tests/chan.test index 4efec11..49afdc6 100644 --- a/tests/chan.test +++ b/tests/chan.test @@ -173,7 +173,7 @@ test chan-16.9 {chan command: pending input subcommand} -setup { lappend ::chan-16.9-data $r $l $e $b $i - if {$r != -1 || $e || $l || !$b || $i > 128} { + if {$r >= 0 || $e || $l || !$b || $i > 128} { set data [read $sock $i] lappend ::chan-16.9-data [string range $data 0 2] lappend ::chan-16.9-data [string range $data end-2 end] diff --git a/tests/http11.test b/tests/http11.test index 7ca57f4..f243e56 100644 --- a/tests/http11.test +++ b/tests/http11.test @@ -19,7 +19,7 @@ variable httpd_output proc create_httpd {} { proc httpd_read {chan} { variable httpd_output - if {[gets $chan line] != -1} { + if {[gets $chan line] >= 0} { #puts stderr "read '$line'" set httpd_output $line } diff --git a/tests/httpTest.tcl b/tests/httpTest.tcl index 326b361..6a2226e 100644 --- a/tests/httpTest.tcl +++ b/tests/httpTest.tcl @@ -60,7 +60,7 @@ proc http::Log {args} { variable TestStartTimeInMs set time [expr {[clock milliseconds] - $TestStartTimeInMs}] set txt [list $time {*}$args] - if {[string first ^ $txt] != -1} { + if {[string first ^ $txt] >= 0} { ::httpTest::LogRecord $txt ::httpTest::Puts $txt } elseif {$::httpTest::testOptions(-verbose) > 1} { @@ -82,7 +82,7 @@ proc httpTest::LogRecord {txt} { puts stdout "Fix this call to Log in http-*.tm so it has ^ then\ a letter then a numeral." flush stdout - } elseif {$pos == -1} { + } elseif {$pos < 0} { # Called by mistake. } else { set letter [string index $txt [incr pos]] @@ -149,7 +149,7 @@ proc httpTest::TestOverlaps {someResults n term msg badTrans notPiped} { set myStart [lsearch -exact $someResults [list B $i]] set myEnd [lsearch -exact $someResults [list $term $i]] - if {($myStart == -1 || $myEnd == -1)} { + if {($myStart < 0 || $myEnd < 0)} { set res "Cannot find positions of transaction $i" append msg $res \n Puts $res @@ -370,7 +370,7 @@ proc httpTest::ProcessRetries {someResults n msg skipOverlaps notIncluded notPip variable testOptions set nextRetry [lsearch -glob -index 0 $someResults {[PQR]}] - if {$nextRetry == -1} { + if {$nextRetry < 0} { return [MostAnalysis $someResults $n $msg $skipOverlaps $notIncluded $notPiped] } set badTrans $notIncluded @@ -387,7 +387,7 @@ proc httpTest::ProcessRetries {someResults n msg skipOverlaps notIncluded notPip for {set i 1} {$i <= $n} {incr i} { set first [lsearch -exact $beforeTry [list A $i]] set last [lsearch -exact $beforeTry [list F $i]] - if {$first == -1} { + if {$first < 0} { set res "Transaction $i was not started in connection number $tryCount" # So lappend it to badTrans and don't include it in the call below of MostAnalysis. # append msg $res \n @@ -396,7 +396,7 @@ proc httpTest::ProcessRetries {someResults n msg skipOverlaps notIncluded notPip lappend badTrans $i } else { } - } elseif {$last == -1} { + } elseif {$last < 0} { set res "Transaction $i was started but unfinished in connection number $tryCount" # So lappend it to badTrans and don't include it in the call below of MostAnalysis. # append msg $res \n diff --git a/tests/httpd11.tcl b/tests/httpd11.tcl index 0b02319..89590ec 100644 --- a/tests/httpd11.tcl +++ b/tests/httpd11.tcl @@ -237,7 +237,7 @@ proc Accept {chan addr port} { } proc Control {chan} { - if {[gets $chan line] != -1} { + if {[gets $chan line] >= 0} { if {[string trim $line] eq "quit"} { set ::forever 1 } diff --git a/tests/obj.test b/tests/obj.test index b6b6eb8..e5fec9a 100644 --- a/tests/obj.test +++ b/tests/obj.test @@ -36,7 +36,7 @@ test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} tes string } { set first [string first $t [testobj types]] - set r [expr {$r && ($first != -1)}] + set r [expr {$r && ($first >= 0)}] } set result $r } {1} diff --git a/tests/reg.test b/tests/reg.test index 02677c7..063b091 100644 --- a/tests/reg.test +++ b/tests/reg.test @@ -49,9 +49,9 @@ catch [list package require -exact Tcltest [info patchlevel]] # subexpressions, checking where empty substrings are located, # etc. should be done using expectIndices and expectPartial. -# The flag characters are complex and a bit eclectic. Generally speaking, +# The flag characters are complex and a bit eclectic. Generally speaking, # lowercase letters are compile options, uppercase are expected re_info -# bits, and nonalphabetics are match options, controls for how the test is +# bits, and nonalphabetics are match options, controls for how the test is # run, or testing options. The one small surprise is that AREs are the # default, and you must explicitly request lesser flavors of RE. The flags # are as follows. It is admitted that some are not very mnemonic. @@ -287,7 +287,7 @@ namespace eval RETest { set infoflags [TestInfoFlags $flags] set ccmd [list testregexp -about {*}$f $re] set nsub [expr {[llength $args] - 1}] - if {$nsub == -1} { + if {$nsub < 0} { # didn't tell us number of subexps set ccmd "lreplace \[$ccmd\] 0 0" set info [list $infoflags] @@ -311,7 +311,7 @@ namespace eval RETest { # match expected (full fanciness) # expectIndices testno flags re target mat submat ... proc expectIndices {args} { - MatchExpected -indices {*}$args + MatchExpected -indices {*}$args } # partial match expected diff --git a/tests/socket.test b/tests/socket.test index 5198f4f..ca60588 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -237,7 +237,7 @@ if {$doTestsWithRemoteServer} { # Some tests are run only if we are doing testing against a remote server. testConstraint doTestsWithRemoteServer $doTestsWithRemoteServer if {!$doTestsWithRemoteServer} { - if {[string first s $::tcltest::verbose] != -1} { + if {[string first s $::tcltest::verbose] >= 0} { puts "Skipping tests with remote server. See tests/socket.test for" puts "information on how to run remote server." puts "Reason for not doing remote tests: $noRemoteTestReason" diff --git a/tests/stringObj.test b/tests/stringObj.test index ce19e96..bfe9da1 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -27,8 +27,8 @@ testConstraint testdstring [llength [info commands testdstring]] test stringObj-1.1 {string type registration} testobj { set t [testobj types] set first [string first "string" $t] - set result [expr {$first != -1}] -} {1} + set result [expr {$first >= 0}] +} 1 test stringObj-2.1 {Tcl_NewStringObj} testobj { set result "" diff --git a/tests/thread.test b/tests/thread.test index 9f14470..7c7dc27 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -36,11 +36,11 @@ set threadSuperKillScript { proc getThreadErrorFromInfo { info } { set list [split $info \n] set idx [lsearch -glob $list "*eval*unwound*"] - if {$idx != -1} then { + if {$idx >= 0} then { return [lindex $list $idx] } set idx [lsearch -glob $list "*eval*canceled*"] - if {$idx != -1} then { + if {$idx >= 0} then { return [lindex $list $idx] } return ""; # some other error we do not care about. diff --git a/tests/unload.test b/tests/unload.test index 05a0104..815ff31 100644 --- a/tests/unload.test +++ b/tests/unload.test @@ -156,14 +156,14 @@ test unload-3.3 {unloading of a package that has never been loaded from a safe i unload [file join $testDir pkga$ext] {} child } -result {file "*" has never been loaded in this interpreter} test unload-3.4 {basic unloading of a non-unloadable package from a safe interpreter, with guess for package name} -setup { - if {[lsearch -index 1 [info loaded child] Pkgb] == -1} { + if {[lsearch -index 1 [info loaded child] Pkgb] < 0} { load [file join $testDir pkgb$ext] pKgB child } } -constraints [list $dll $loaded] -returnCodes error -match glob -body { unload [file join $testDir pkgb$ext] {} child } -result {file "*" cannot be unloaded under a safe interpreter} test unload-3.5 {basic unloading of an unloadable package from a safe interpreter, with guess for package name} -setup { - if {[lsearch -index 1 [info loaded child] Pkgua] == -1} { + if {[lsearch -index 1 [info loaded child] Pkgua] < 0} { load [file join $testDir pkgua$ext] pkgua child } } -constraints [list $dll $loaded] -body { |