@@ -432,6 +432,7 @@ test string-3.45f.$noComp {string equal -nocase empty string against byte array}
432
432
run {string equal -nocase [binary decode hex 00] ""}
433
433
} 0
434
434
435
+
435
436
test string-4.1.$noComp {string first, not enough args} {
436
437
list [catch {run {string first a}} msg] $msg
437
438
} {1 {wrong # args: should be "string first needleString haystackString ?startIndex?"}}
@@ -2072,47 +2073,47 @@ test string-23.0.$noComp {string is boolean, Bug 1187123} testindexobj {
2072
2073
test string-23.1.$noComp {string is command with empty string} {
2073
2074
set s ""
2074
2075
list \
2075
- [run {string is alnum $s}] \
2076
- [run {string is alpha $s}] \
2077
- [run {string is ascii $s}] \
2078
- [run {string is control $s}] \
2079
- [run {string is boolean $s}] \
2080
- [run {string is digit $s}] \
2081
- [run {string is double $s}] \
2082
- [run {string is false $s}] \
2083
- [run {string is graph $s}] \
2084
- [run {string is integer $s}] \
2085
- [run {string is lower $s}] \
2086
- [run {string is print $s}] \
2087
- [run {string is punct $s}] \
2088
- [run {string is space $s}] \
2089
- [run {string is true $s}] \
2090
- [run {string is upper $s}] \
2091
- [run {string is wordchar $s}] \
2092
- [run {string is xdigit $s}] \
2076
+ [run {string is alnum $s}] \
2077
+ [run {string is alpha $s}] \
2078
+ [run {string is ascii $s}] \
2079
+ [run {string is control $s}] \
2080
+ [run {string is boolean $s}] \
2081
+ [run {string is digit $s}] \
2082
+ [run {string is double $s}] \
2083
+ [run {string is false $s}] \
2084
+ [run {string is graph $s}] \
2085
+ [run {string is integer $s}] \
2086
+ [run {string is lower $s}] \
2087
+ [run {string is print $s}] \
2088
+ [run {string is punct $s}] \
2089
+ [run {string is space $s}] \
2090
+ [run {string is true $s}] \
2091
+ [run {string is upper $s}] \
2092
+ [run {string is wordchar $s}] \
2093
+ [run {string is xdigit $s}] \
2093
2094
2094
2095
} {1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1}
2095
2096
test string-23.2.$noComp {string is command with empty string} {
2096
2097
set s ""
2097
2098
list \
2098
- [run {string is alnum -strict $s}] \
2099
- [run {string is alpha -strict $s}] \
2100
- [run {string is ascii -strict $s}] \
2101
- [run {string is control -strict $s}] \
2102
- [run {string is boolean -strict $s}] \
2103
- [run {string is digit -strict $s}] \
2104
- [run {string is double -strict $s}] \
2105
- [run {string is false -strict $s}] \
2106
- [run {string is graph -strict $s}] \
2107
- [run {string is integer -strict $s}] \
2108
- [run {string is lower -strict $s}] \
2109
- [run {string is print -strict $s}] \
2110
- [run {string is punct -strict $s}] \
2111
- [run {string is space -strict $s}] \
2112
- [run {string is true -strict $s}] \
2113
- [run {string is upper -strict $s}] \
2114
- [run {string is wordchar -strict $s}] \
2115
- [run {string is xdigit -strict $s}] \
2099
+ [run {string is alnum -strict $s}] \
2100
+ [run {string is alpha -strict $s}] \
2101
+ [run {string is ascii -strict $s}] \
2102
+ [run {string is control -strict $s}] \
2103
+ [run {string is boolean -strict $s}] \
2104
+ [run {string is digit -strict $s}] \
2105
+ [run {string is double -strict $s}] \
2106
+ [run {string is false -strict $s}] \
2107
+ [run {string is graph -strict $s}] \
2108
+ [run {string is integer -strict $s}] \
2109
+ [run {string is lower -strict $s}] \
2110
+ [run {string is print -strict $s}] \
2111
+ [run {string is punct -strict $s}] \
2112
+ [run {string is space -strict $s}] \
2113
+ [run {string is true -strict $s}] \
2114
+ [run {string is upper -strict $s}] \
2115
+ [run {string is wordchar -strict $s}] \
2116
+ [run {string is xdigit -strict $s}] \
2116
2117
2117
2118
} {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}
2118
2119
@@ -2283,12 +2284,12 @@ test string-26.10.$noComp {tcl::prefix} -body {
2283
2284
} -returnCodes 2 -result {ambiguous option "be": must be apa, bepa, bear, or depa}
2284
2285
test string-26.10.1.$noComp {tcl::prefix} -setup {
2285
2286
proc _testprefix {args} {
2286
- array set opts {-a x -b y -c y}
2287
- foreach {opt val} $args {
2288
- set opt [tcl::prefix match -error {-level 1} {-a -b -c} $opt]
2289
- set opts($opt) $val
2290
- }
2291
- array get opts
2287
+ array set opts {-a x -b y -c y}
2288
+ foreach {opt val} $args {
2289
+ set opt [tcl::prefix match -error {-level 1} {-a -b -c} $opt]
2290
+ set opts($opt) $val
2291
+ }
2292
+ array get opts
2292
2293
}
2293
2294
} -body {
2294
2295
set a [catch {_testprefix -x u} result options]
@@ -2304,37 +2305,37 @@ test string-26.10.1.$noComp {tcl::prefix} -setup {
2304
2305
proc MemStress {args} {
2305
2306
set res {}
2306
2307
foreach body $args {
2307
- set end 0
2308
- for {set i 0} {$i < 5} {incr i} {
2309
- proc MemStress_Body {} $body
2310
- uplevel 1 MemStress_Body
2311
- rename MemStress_Body {}
2312
- set tmp $end
2313
- set end [lindex [lindex [split [memory info] "\n"] 3] 3]
2314
- }
2315
- lappend res [expr {$end - $tmp}]
2308
+ set end 0
2309
+ for {set i 0} {$i < 5} {incr i} {
2310
+ proc MemStress_Body {} $body
2311
+ uplevel 1 MemStress_Body
2312
+ rename MemStress_Body {}
2313
+ set tmp $end
2314
+ set end [lindex [lindex [split [memory info] "\n"] 3] 3]
2315
+ }
2316
+ lappend res [expr {$end - $tmp}]
2316
2317
}
2317
2318
return $res
2318
2319
}
2319
2320
2320
2321
test string-26.11.$noComp {tcl::prefix: testing for leaks} -body {
2321
2322
# This test is made to stress object reference management
2322
2323
MemStress {
2323
- set table {hejj miff gurk}
2324
- set item [lindex $table 1]
2325
- # If not careful, this can cause a circular reference
2326
- # that will cause a leak.
2327
- tcl::prefix match $table $item
2324
+ set table {hejj miff gurk}
2325
+ set item [lindex $table 1]
2326
+ # If not careful, this can cause a circular reference
2327
+ # that will cause a leak.
2328
+ tcl::prefix match $table $item
2328
2329
} {
2329
- # A similar case with nested lists
2330
- set table2 {hejj {miff maff} gurk}
2331
- set item [lindex [lindex $table2 1] 0]
2332
- tcl::prefix match $table2 $item
2330
+ # A similar case with nested lists
2331
+ set table2 {hejj {miff maff} gurk}
2332
+ set item [lindex [lindex $table2 1] 0]
2333
+ tcl::prefix match $table2 $item
2333
2334
} {
2334
- # A similar case with dict
2335
- set table3 {hejj {miff maff} gurk2}
2336
- set item [lindex [dict keys [lindex $table3 1]] 0]
2337
- tcl::prefix match $table3 $item
2335
+ # A similar case with dict
2336
+ set table3 {hejj {miff maff} gurk2}
2337
+ set item [lindex [dict keys [lindex $table3 1]] 0]
2338
+ tcl::prefix match $table3 $item
2338
2339
}
2339
2340
} -constraints memory -result {0 0 0}
2340
2341
@@ -2343,29 +2344,29 @@ test string-26.12.$noComp {tcl::prefix: testing for leaks} -body {
2343
2344
# in real code. The shared literal "miff" causes a connection
2344
2345
# between the item and the table.
2345
2346
MemStress {
2346
- proc stress1 {item} {
2347
- set table [list hejj miff gurk]
2348
- tcl::prefix match $table $item
2349
- }
2350
- proc stress2 {} {
2351
- stress1 miff
2352
- }
2353
- stress2
2354
- rename stress1 {}
2355
- rename stress2 {}
2347
+ proc stress1 {item} {
2348
+ set table [list hejj miff gurk]
2349
+ tcl::prefix match $table $item
2350
+ }
2351
+ proc stress2 {} {
2352
+ stress1 miff
2353
+ }
2354
+ stress2
2355
+ rename stress1 {}
2356
+ rename stress2 {}
2356
2357
}
2357
2358
} -constraints memory -result 0
2358
2359
2359
2360
test string-26.13.$noComp {tcl::prefix: testing for leaks} -body {
2360
2361
# This test is made to stress object reference management
2361
2362
MemStress {
2362
- set table [list hejj miff]
2363
- set item $table
2364
- set error $table
2365
- # Use the same objects in all places
2366
- catch {
2367
- tcl::prefix match -error $error $table $item
2368
- }
2363
+ set table [list hejj miff]
2364
+ set item $table
2365
+ set error $table
2366
+ # Use the same objects in all places
2367
+ catch {
2368
+ tcl::prefix match -error $error $table $item
2369
+ }
2369
2370
}
2370
2371
} -constraints memory -result {0}
2371
2372
0 commit comments