summaryrefslogtreecommitdiffstats
path: root/tests/string.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/string.test')
-rw-r--r--tests/string.test1166
1 files changed, 758 insertions, 408 deletions
diff --git a/tests/string.test b/tests/string.test
index 3809ba9..cd396c2 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -11,604 +11,963 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: string.test,v 1.7 1999/05/04 02:57:55 stanton Exp $
+# RCS: @(#) $Id: string.test,v 1.8 1999/05/06 18:46:43 stanton Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
}
-test string-1.1 {string compare} {
+test string-1.1 {error conditions} {
+ list [catch {string gorp a b} msg] $msg
+} {1 {bad option "gorp": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
+test string-1.2 {error conditions} {
+ list [catch {string} msg] $msg
+} {1 {wrong # args: should be "string option arg ?arg ...?"}}
+
+test string-2.1 {string compare, too few args} {
+ list [catch {string compare a} msg] $msg
+} {1 {wrong # args: should be "string compare ?-nocase? ?-length int? string1 string2"}}
+test string-2.2 {string compare, bad args} {
+ list [catch {string compare a b c} msg] $msg
+} {1 {bad option "a": must be -nocase or -length}}
+test string-2.3 {string compare, bad args} {
+ list [catch {string compare -length -nocase str1 str2} msg] $msg
+} {1 {expected integer but got "-nocase"}}
+test string-2.4 {string compare, too many args} {
+ list [catch {string compare -length 10 -nocase str1 str2 str3} msg] $msg
+} {1 {wrong # args: should be "string compare ?-nocase? ?-length int? string1 string2"}}
+test string-2.5 {string compare with length unspecified} {
+ list [catch {string compare -length 10 10} msg] $msg
+} {1 {wrong # args: should be "string compare ?-nocase? ?-length int? string1 string2"}}
+test string-2.6 {string compare} {
string compare abcde abdef
} -1
-test string-1.2 {string compare, shortest method name} {
+test string-2.7 {string compare, shortest method name} {
string c abcde ABCDE
} 1
-test string-1.3 {string compare} {
+test string-2.8 {string compare} {
string compare abcde abcde
} 0
-test string-1.4 {string compare too few args} {
- list [catch {string compare a} msg] $msg
-} {1 {wrong # args: should be "string compare string1 string2 ?length?"}}
-test string-1.5 {string compare bad args} {
- list [catch {string compare a b c} msg] $msg
-} {1 {expected integer but got "c"}}
-test string-1.6 {string compare too many args} {
- list [catch {string compare a b 1 c} msg] $msg
-} {1 {wrong # args: should be "string compare string1 string2 ?length?"}}
-test string-1.7 {string compare with length} {
- string compare abcde abxyz 2
+test string-2.9 {string compare with length} {
+ string compare -length 2 abcde abxyz
} 0
-test string-1.8 {string compare with special index} {
- list [catch {string compare abcde abxyz end-3} msg] $msg
+test string-2.10 {string compare with special index} {
+ list [catch {string compare -length end-3 abcde abxyz} msg] $msg
+} {1 {expected integer but got "end-3"}}
+test string-2.11 {string compare, unicode} {
+ string compare ab\u7266 ab\u7267
+} -1
+test string-2.12 {string compare, high bit} {
+ # This test will fail if the underlying comparaison
+ # is using signed chars instead of unsigned chars.
+ # (like SunOS's default memcmp thus the compat/memcmp.c)
+ string compare "\x80" "@"
+ # Nb this tests works also in utf8 space because \x80 is
+ # translated into a 2 or more bytelength but whose first byte has
+ # the high bit set.
+} 1
+test string-2.13 {string compare -nocase} {
+ string compare -nocase abcde abdef
+} -1
+test string-2.14 {string compare -nocase} {
+ string c -nocase abcde ABCDE
+} 0
+test string-2.15 {string compare -nocase} {
+ string compare -nocase abcde abcde
+} 0
+test string-2.16 {string compare -nocase with length} {
+ string compare -length 2 -nocase abcde Abxyz
+} 0
+test string-2.17 {string compare -nocase with length} {
+ string compare -nocase -length 3 abcde Abxyz
+} -1
+test string-2.18 {string compare -nocase with length <= 0} {
+ string compare -nocase -length -1 abcde AbCdEf
+} 0
+test string-2.19 {string compare -nocase with excessive length} {
+ string compare -nocase -length 50 AbCdEf abcde
+} 1
+test string-2.20 {string compare -len unicode} {
+ # These are strings that are 6 BYTELENGTH long, but the length
+ # shouldn't make a different because there are actually 3 CHARS long
+ string compare -len 5 \334\334\334 \334\334\374
+} -1
+test string-2.21 {string compare -nocase with special index} {
+ list [catch {string compare -nocase -length end-3 Abcde abxyz} msg] $msg
} {1 {expected integer but got "end-3"}}
-test string-2.1 {string first} {
+# only need a few tests on equal, since it uses the same code as
+# string compare, but just modifies the return output
+test string-3.1 {string equal} {
+ string equal abcde abdef
+} 0
+test string-3.2 {string equal} {
+ string eq abcde ABCDE
+} 0
+test string-3.3 {string equal} {
+ string equal abcde abcde
+} 1
+test string-3.4 {string equal -nocase} {
+ string equal -nocase \334\334\334\334\374\374\374\374 \334\334\334\334\334\334\334\334
+} 1
+test string-3.5 {string equal -nocase} {
+ string equal -nocase abcde abdef
+} 0
+test string-3.6 {string equal -nocase} {
+ string eq -nocase abcde ABCDE
+} 1
+test string-3.7 {string equal -nocase} {
+ string equal -nocase abcde abcde
+} 1
+
+test string-4.1 {string first} {
+ list [catch {string first a} msg] $msg
+} {1 {wrong # args: should be "string first string1 string2"}}
+test string-4.2 {string first} {
+ list [catch {string first a b c} msg] $msg
+} {1 {wrong # args: should be "string first string1 string2"}}
+test string-4.3 {string first} {
string first bq abcdefgbcefgbqrs
} 12
-test string-2.2 {string first} {
+test string-4.4 {string first} {
string fir bcd abcdefgbcefgbqrs
} 1
-test string-2.3 {string first} {
+test string-4.5 {string first} {
string f b abcdefgbcefgbqrs
} 1
-test string-2.4 {string first} {
+test string-4.6 {string first} {
string first xxx x123xx345xxx789xxx012
} 9
-test string-2.5 {string first} {
+test string-4.7 {string first} {
string first "" x123xx345xxx789xxx012
} -1
-test string-2.6 {string first} {
- list [catch {string first a} msg] $msg
-} {1 {wrong # args: should be "string first string1 string2"}}
-test string-2.7 {string first} {
- list [catch {string first a b c} msg] $msg
-} {1 {wrong # args: should be "string first string1 string2"}}
+test string-4.8 {string first, unicode} {
+ string first x abc\u7266x
+} 4
+test string-4.9 {string first, unicode} {
+ string first \u7266 abc\u7266x
+} 3
-test string-3.1 {string index} {
+test string-5.1 {string index} {
+ list [catch {string index} msg] $msg
+} {1 {wrong # args: should be "string index string charIndex"}}
+test string-5.2 {string index} {
+ list [catch {string index a b c} msg] $msg
+} {1 {wrong # args: should be "string index string charIndex"}}
+test string-5.3 {string index} {
string index abcde 0
} a
-test string-3.2 {string index} {
+test string-5.4 {string index} {
string in abcde 4
} e
-test string-3.3 {string index} {
+test string-5.5 {string index} {
string index abcde 5
} {}
-test string-3.4 {string index} {
+test string-5.6 {string index} {
list [catch {string index abcde -10} msg] $msg
} {0 {}}
-test string-3.5 {string index} {
- list [catch {string index} msg] $msg
-} {1 {wrong # args: should be "string index string charIndex"}}
-test string-3.6 {string index} {
- list [catch {string index a b c} msg] $msg
-} {1 {wrong # args: should be "string index string charIndex"}}
-test string-3.7 {string index} {
+test string-5.7 {string index} {
list [catch {string index a xyz} msg] $msg
-} {1 {syntax error in expression "xyz"}}
-test string-3.8 {string index} {
+} {1 {bad index "xyz": must be integer or end?-integer?}}
+test string-5.8 {string index} {
string index abc end
} c
-test string-3.9 {string index} {
+test string-5.9 {string index} {
string index abc end-1
} b
-
-test string-4.1 {string last} {
+test string-5.10 {string index, unicode} {
+ string index abc\u7266d 4
+} d
+test string-5.11 {string index, unicode} {
+ string index abc\u7266d 3
+} \u7266
+
+test string-6.1 {string is, too few args} {
+ list [catch {string is} msg] $msg
+} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}
+test string-6.2 {string is, too few args} {
+ list [catch {string is alpha} msg] $msg
+} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}
+test string-6.3 {string is, bad args} {
+ list [catch {string is alpha -failin str} msg] $msg
+} {1 {wrong # args: should be "string is alpha ?-strict? ?-failindex var? str"}}
+test string-6.4 {string is, too many args} {
+ list [catch {string is alpha -failin var -strict str more} msg] $msg
+} {1 {wrong # args: should be "string is class ?-strict? ?-failindex var? str"}}
+test string-6.5 {string is, class check} {
+ list [catch {string is bogus str} msg] $msg
+} {1 {bad class "bogus": must be alnum, alpha, ascii, boolean, digit, double, false, integer, lower, space, true, upper, or wordchar}}
+test string-6.6 {string is, ambiguous class} {
+ list [catch {string is al str} msg] $msg
+} {1 {ambiguous class "al": must be alnum, alpha, ascii, boolean, digit, double, false, integer, lower, space, true, upper, or wordchar}}
+test string-6.7 {string is alpha, all ok} {
+ string is alpha -strict -failindex var abc
+} 1
+test string-6.8 {string is, error in var} {
+ list [string is alpha -failindex var abc5def] $var
+} {0 3}
+test string-6.9 {string is, var shouldn't get set} {
+ catch {unset var}
+ list [catch {string is alpha -failindex var abc; set var} msg] $msg
+} {1 {can't read "var": no such variable}}
+test string-6.10 {string is, ok on empty} {
+ string is alpha {}
+} 1
+test string-6.11 {string is, -strict check against empty} {
+ string is alpha -strict {}
+} 0
+test string-6.12 {string is alnum, true} {
+ string is alnum abc123
+} 1
+test string-6.13 {string is alnum, false} {
+ list [string is alnum -failindex var abc1.23] $var
+} {0 4}
+test string-6.14 {string is alnum, unicode} {
+ string is alnum abcü
+} 1
+test string-6.15 {string is alpha, true} {
+ string is alpha abc
+} 1
+test string-6.16 {string is alpha, false} {
+ list [string is alpha -fail var a1bcde] $var
+} {0 1}
+test string-6.17 {string is alpha, unicode} {
+ string is alpha abc\374
+} 1
+test string-6.18 {string is ascii, true} {
+ string is ascii abc\u007Fend
+} 1
+test string-6.19 {string is ascii, false} {
+ list [string is ascii -fail var abcdef\u0080more] $var
+} {0 6}
+test string-6.20 {string is boolean, true} {
+ string is boolean true
+} 1
+test string-6.21 {string is boolean, true} {
+ string is boolean f
+} 1
+test string-6.22 {string is boolean, true based on type} {
+ string is bool [string compare a a]
+} 1
+test string-6.23 {string is boolean, false} {
+ list [string is bool -fail var yada] $var
+} {0 0}
+test string-6.24 {string is digit, true} {
+ string is digit 0123456789
+} 1
+test string-6.25 {string is digit, false} {
+ list [string is digit -fail var 0123Ü567] $var
+} {0 4}
+test string-6.26 {string is digit, false} {
+ list [string is digit -fail var +123567] $var
+} {0 0}
+test string-6.27 {string is double, true} {
+ string is double 1
+} 1
+test string-6.28 {string is double, true} {
+ string is double [expr double(1)]
+} 1
+test string-6.29 {string is double, true} {
+ string is double 1.0
+} 1
+test string-6.30 {string is double, true} {
+ string is double [string compare a a]
+} 1
+test string-6.31 {string is double, true} {
+ string is double " +1.0e-1 "
+} 1
+test string-6.32 {string is double, true} {
+ string is double "\n1.0\v"
+} 1
+test string-6.33 {string is double, false} {
+ list [string is double -fail var 1abc] $var
+} {0 1}
+test string-6.34 {string is double, false} {
+ list [string is double -fail var abc] $var
+} {0 0}
+test string-6.35 {string is double, false} {
+ list [string is double -fail var " 1.0e4e4 "] $var
+} {0 8}
+test string-6.36 {string is double, false} {
+ list [string is double -fail var "\n"] $var
+} {0 0}
+test string-6.37 {string is double, false on int overflow} {
+ list [string is double -fail var 12345678901234567890] $var
+} {0 -1}
+test string-6.38 {string is double, false on underflow} {
+ catch {unset var}
+ list [string is double -fail var 123e-9999] $var
+} {0 -1}
+test string-6.39 {string is double, false} {
+ list [string is double -fail var .e1] $var
+} {0 0}
+test string-6.40 {string is false, true} {
+ string is false false
+} 1
+test string-6.41 {string is false, true} {
+ string is false FaLsE
+} 1
+test string-6.42 {string is false, true} {
+ string is false N
+} 1
+test string-6.43 {string is false, true} {
+ string is false 0
+} 1
+test string-6.44 {string is false, true} {
+ string is false off
+} 1
+test string-6.45 {string is false, false} {
+ list [string is false -fail var abc] $var
+} {0 0}
+test string-6.46 {string is false, false} {
+ catch {unset var}
+ list [string is false -fail var Y] $var
+} {0 0}
+test string-6.47 {string is false, false} {
+ catch {unset var}
+ list [string is false -fail var offensive] $var
+} {0 0}
+test string-6.48 {string is integer, true} {
+ string is integer +1234567890
+} 1
+test string-6.49 {string is integer, true on type} {
+ string is integer [expr int(50.0)]
+} 1
+test string-6.50 {string is integer, true} {
+ string is integer [list -10]
+} 1
+test string-6.51 {string is integer, true as hex} {
+ string is integer 0xabcdef
+} 1
+test string-6.52 {string is integer, true as octal} {
+ string is integer 012345
+} 1
+test string-6.53 {string is integer, true with whitespace} {
+ string is integer " \n1234\v"
+} 1
+test string-6.54 {string is integer, false} {
+ list [string is integer -fail var 123abc] $var
+} {0 3}
+test string-6.55 {string is integer, false on overflow} {
+ list [string is integer -fail var +12345678901234567890] $var
+} {0 -1}
+test string-6.56 {string is integer, false} {
+ list [string is integer -fail var [expr double(1)]] $var
+} {0 1}
+test string-6.57 {string is integer, false} {
+ list [string is integer -fail var " "] $var
+} {0 0}
+test string-6.58 {string is integer, false on bad octal} {
+ list [string is integer -fail var 036963] $var
+} {0 3}
+test string-6.59 {string is integer, false on bad hex} {
+ list [string is integer -fail var 0X345XYZ] $var
+} {0 5}
+test string-6.60 {string is lower, true} {
+ string is lower abc
+} 1
+test string-6.61 {string is lower, unicode true} {
+ string is lower abcüue
+} 1
+test string-6.62 {string is lower, false} {
+ list [string is lower -fail var aBc] $var
+} {0 1}
+test string-6.63 {string is lower, false} {
+ list [string is lower -fail var abc1] $var
+} {0 3}
+test string-6.64 {string is lower, unicode false} {
+ list [string is lower -fail var abÜUE] $var
+} {0 2}
+test string-6.65 {string is space, true} {
+ string is space " \t\n\v\f"
+} 1
+test string-6.66 {string is space, false} {
+ list [string is space -fail var " \t\n\v1\f"] $var
+} {0 4}
+test string-6.67 {string is true, true} {
+ string is true true
+} 1
+test string-6.68 {string is true, true} {
+ string is true TrU
+} 1
+test string-6.69 {string is true, true} {
+ string is true ye
+} 1
+test string-6.70 {string is true, true} {
+ string is true 1
+} 1
+test string-6.71 {string is true, true} {
+ string is true on
+} 1
+test string-6.72 {string is true, false} {
+ list [string is true -fail var onto] $var
+} {0 0}
+test string-6.73 {string is true, false} {
+ catch {unset var}
+ list [string is true -fail var 25] $var
+} {0 0}
+test string-6.74 {string is true, false} {
+ catch {unset var}
+ list [string is true -fail var no] $var
+} {0 0}
+test string-6.75 {string is upper, true} {
+ string is upper ABC
+} 1
+test string-6.76 {string is upper, unicode true} {
+ string is upper ABCÜUE
+} 1
+test string-6.77 {string is upper, false} {
+ list [string is upper -fail var AbC] $var
+} {0 1}
+test string-6.78 {string is upper, false} {
+ list [string is upper -fail var AB2C] $var
+} {0 2}
+test string-6.79 {string is upper, unicode false} {
+ list [string is upper -fail var ABCüue] $var
+} {0 3}
+test string-6.80 {string is wordchar, true} {
+ string is wordchar abc_123
+} 1
+test string-6.81 {string is wordchar, unicode true} {
+ string is wordchar abcüabÜAB\u5001
+} 1
+test string-6.82 {string is wordchar, false} {
+ list [string is wordchar -fail var abcd.ef] $var
+} {0 4}
+test string-6.83 {string is wordchar, unicode false} {
+ list [string is wordchar -fail var abc\u0080def] $var
+} {0 3}
+
+test string-7.1 {string last} {
+ list [catch {string last a} msg] $msg
+} {1 {wrong # args: should be "string last string1 string2"}}
+test string-7.2 {string last} {
+ list [catch {string last a b c} msg] $msg
+} {1 {wrong # args: should be "string last string1 string2"}}
+test string-7.3 {string last} {
string la xxx xxxx123xx345x678
} 1
-test string-4.2 {string last} {
+test string-7.4 {string last} {
string last xx xxxx123xx345x678
} 7
-test string-4.3 {string last} {
+test string-7.5 {string last} {
string las x xxxx123xx345x678
} 12
-test string-4.4 {string last} {
- list [catch {string last a} msg] $msg
-} {1 {wrong # args: should be "string last string1 string2"}}
-test string-4.5 {string last} {
- list [catch {string last a b c} msg] $msg
-} {1 {wrong # args: should be "string last string1 string2"}}
+test string-7.6 {string last, unicode} {
+ string las x xxxx12\u7266xx345x678
+} 12
+test string-7.7 {string last, unicode} {
+ string las \u7266 xxxx12\u7266xx345x678
+} 6
-test string-5.1 {string length} {
- string length "a little string"
-} 15
-test string-5.2 {string length} {
- string le ""
+test cmdMZ-8.1 {Tcl_StringObjCmd: string bytelength} {
+ list [catch {string bytelength} msg] $msg
+} {1 {wrong # args: should be "string bytelength string"}}
+test cmdMZ-8.2 {Tcl_StringObjCmd: string bytelength} {
+ list [catch {string bytelength a b} msg] $msg
+} {1 {wrong # args: should be "string bytelength string"}}
+test cmdMZ-8.3 {Tcl_StringObjCmd: string bytelength} {
+ string bytelength "\u00c7"
+} 2
+test cmdMZ-8.4 {Tcl_StringObjCmd: string bytelength} {
+ string b ""
} 0
-test string-5.3 {string length} {
+
+test string-9.1 {string length} {
list [catch {string length} msg] $msg
} {1 {wrong # args: should be "string length string"}}
-test string-5.4 {string length} {
+test string-9.2 {string length} {
list [catch {string length a b} msg] $msg
} {1 {wrong # args: should be "string length string"}}
+test string-9.3 {string length} {
+ string length "a little string"
+} 15
+test string-9.4 {string length} {
+ string le ""
+} 0
+test string-9.5 {string length, unicode} {
+ string le "abcd\u7266"
+} 5
-test string-6.1 {string match} {
+test string-10.1 {string map, too few args} {
+ list [catch {string map} msg] $msg
+} {1 {wrong # args: should be "string map ?-nocase? charMap string"}}
+test string-10.2 {string map, bad args} {
+ list [catch {string map {a b} abba oops} msg] $msg
+} {1 {bad option "a b": must be -nocase}}
+test string-10.3 {string map, too many args} {
+ list [catch {string map -nocase {a b} str1 str2} msg] $msg
+} {1 {wrong # args: should be "string map ?-nocase? charMap string"}}
+test string-10.4 {string map} {
+ string map {a b} abba
+} {bbbb}
+test string-10.5 {string map} {
+ string map {a b} a
+} {b}
+test string-10.6 {string map -nocase} {
+ string map -nocase {a b} Abba
+} {bbbb}
+test string-10.7 {string map} {
+ string map {abc 321 ab * a A} aabcabaababcab
+} {A321*A*321*}
+test string-10.8 {string map -nocase} {
+ string map -nocase {aBc 321 Ab * a A} aabcabaababcab
+} {A321*A*321*}
+test string-10.9 {string map -nocase} {
+ string map -no {abc 321 Ab * a A} aAbCaBaAbAbcAb
+} {A321*A*321*}
+test string-10.10 {string map} {
+ list [catch {string map {a b c} abba} msg] $msg
+} {1 {char map list unbalanced}}
+test string-10.11 {string map, nulls} {
+ string map {\x00 NULL blah \x00nix} {qwerty}
+} {qwerty}
+test string-10.12 {string map, unicode} {
+ string map [list \374 ue UE \334] "a\374ueUE\000EU"
+} aueue\334\0EU
+test string-10.13 {string map, -nocase unicode} {
+ string map -nocase [list \374 ue UE \334] "a\374ueUE\000EU"
+} aue\334\334\0EU
+
+test string-11.1 {string match} {
+ list [catch {string match a} msg] $msg
+} {1 {wrong # args: should be "string match pattern string"}}
+test string-11.2 {string match} {
+ list [catch {string match a b c} msg] $msg
+} {1 {wrong # args: should be "string match pattern string"}}
+test string-11.3 {string match} {
string match abc abc
} 1
-test string-6.2 {string match} {
+test string-11.4 {string match} {
string mat abc abd
} 0
-test string-6.3 {string match} {
+test string-11.5 {string match} {
string match ab*c abc
} 1
-test string-6.4 {string match} {
+test string-11.6 {string match} {
string match ab**c abc
} 1
-test string-6.5 {string match} {
+test string-11.7 {string match} {
string match ab* abcdef
} 1
-test string-6.6 {string match} {
+test string-11.8 {string match} {
string match *c abc
} 1
-test string-6.7 {string match} {
+test string-11.9 {string match} {
string match *3*6*9 0123456789
} 1
-test string-6.8 {string match} {
+test string-11.10 {string match} {
string match *3*6*9 01234567890
} 0
-test string-6.9 {string match} {
+test string-11.11 {string match} {
string match a?c abc
} 1
-test string-6.10 {string match} {
+test string-11.12 {string match} {
string match a??c abc
} 0
-test string-6.11 {string match} {
+test string-11.13 {string match} {
string match ?1??4???8? 0123456789
} 1
-test string-6.12 {string match} {
+test string-11.14 {string match} {
string match {[abc]bc} abc
} 1
-test string-6.13 {string match} {
+test string-11.15 {string match} {
string match {a[abc]c} abc
} 1
-test string-6.14 {string match} {
+test string-11.16 {string match} {
string match {a[xyz]c} abc
} 0
-test string-6.15 {string match} {
+test string-11.17 {string match} {
string match {12[2-7]45} 12345
} 1
-test string-6.16 {string match} {
+test string-11.18 {string match} {
string match {12[ab2-4cd]45} 12345
} 1
-test string-6.17 {string match} {
+test string-11.19 {string match} {
string match {12[ab2-4cd]45} 12b45
} 1
-test string-6.18 {string match} {
+test string-11.20 {string match} {
string match {12[ab2-4cd]45} 12d45
} 1
-test string-6.19 {string match} {
+test string-11.21 {string match} {
string match {12[ab2-4cd]45} 12145
} 0
-test string-6.20 {string match} {
+test string-11.22 {string match} {
string match {12[ab2-4cd]45} 12545
} 0
-test string-6.21 {string match} {
+test string-11.23 {string match} {
string match {a\*b} a*b
} 1
-test string-6.22 {string match} {
+test string-11.24 {string match} {
string match {a\*b} ab
} 0
-test string-6.23 {string match} {
+test string-11.25 {string match} {
string match {a\*\?\[\]\\\x} "a*?\[\]\\x"
} 1
-test string-6.24 {string match} {
+test string-11.26 {string match} {
string match ** ""
} 1
-test string-6.25 {string match} {
+test string-11.27 {string match} {
string match *. ""
} 0
-test string-6.26 {string match} {
+test string-11.28 {string match} {
string match "" ""
} 1
-test string-6.27 {string match} {
+test string-11.29 {string match} {
string match \[a a
} 1
-test string-6.28 {string match} {
- list [catch {string match a} msg] $msg
-} {1 {wrong # args: should be "string match pattern string"}}
-test string-6.29 {string match} {
- list [catch {string match a b c} msg] $msg
-} {1 {wrong # args: should be "string match pattern string"}}
-test string-7.1 {string range} {
+test string-12.1 {string range} {
+ list [catch {string range} msg] $msg
+} {1 {wrong # args: should be "string range string first last"}}
+test string-12.2 {string range} {
+ list [catch {string range a 1} msg] $msg
+} {1 {wrong # args: should be "string range string first last"}}
+test string-12.3 {string range} {
+ list [catch {string range a 1 2 3} msg] $msg
+} {1 {wrong # args: should be "string range string first last"}}
+test string-12.4 {string range} {
string range abcdefghijklmnop 2 14
} {cdefghijklmno}
-test string-7.2 {string range} {
+test string-12.5 {string range, last > length} {
string range abcdefghijklmnop 7 1000
} {hijklmnop}
-test string-7.3 {string range} {
+test string-12.6 {string range} {
string range abcdefghijklmnop 10 e
} {klmnop}
-test string-7.4 {string range} {
+test string-12.7 {string range, last < first} {
string range abcdefghijklmnop 10 9
} {}
-test string-7.5 {string range} {
+test string-12.8 {string range, first < 0} {
string range abcdefghijklmnop -3 2
} {abc}
-test string-7.6 {string range} {
+test string-12.9 {string range} {
string range abcdefghijklmnop -3 -2
} {}
-test string-7.7 {string range} {
+test string-12.10 {string range} {
string range abcdefghijklmnop 1000 1010
} {}
-test string-7.8 {string range} {
+test string-12.11 {string range} {
string range abcdefghijklmnop -100 end
} {abcdefghijklmnop}
-test string-7.9 {string range} {
- list [catch {string range} msg] $msg
-} {1 {wrong # args: should be "string range string first last"}}
-test string-7.10 {string range} {
- list [catch {string range a 1} msg] $msg
-} {1 {wrong # args: should be "string range string first last"}}
-test string-7.11 {string range} {
- list [catch {string range a 1 2 3} msg] $msg
-} {1 {wrong # args: should be "string range string first last"}}
-test string-7.12 {string range} {
+test string-12.12 {string range} {
list [catch {string range abc abc 1} msg] $msg
-} {1 {syntax error in expression "abc"}}
-test string-7.13 {string range} {
+} {1 {bad index "abc": must be integer or end?-integer?}}
+test string-12.13 {string range} {
list [catch {string range abc 1 eof} msg] $msg
-} {1 {syntax error in expression "eof"}}
-test string-7.14 {string range} {
+} {1 {bad index "eof": must be integer or end?-integer?}}
+test string-12.14 {string range} {
string range abcdefghijklmnop end-1 end
} {op}
-test string-7.15 {string range} {
+test string-12.15 {string range} {
string range abcdefghijklmnop e 1000
} {p}
-test string-7.16 {string range} {
+test string-12.16 {string range} {
string range abcdefghijklmnop end end-1
} {}
+test string-12.17 {string range, unicode} {
+ string range ab\u7266cdefghijklmnop 5 5
+} e
+test string-12.18 {string range, unicode} {
+ string range ab\u7266cdefghijklmnop 2 3
+} \u7266c
-test string-8.1 {string trim} {
- string trim " XYZ "
-} {XYZ}
-test string-8.2 {string trim} {
- string trim "\t\nXYZ\t\n\r\n"
-} {XYZ}
-test string-8.3 {string trim} {
- string trim " A XYZ A "
-} {A XYZ A}
-test string-8.4 {string trim} {
- string trim "XXYYZZABC XXYYZZ" ZYX
-} {ABC }
-test string-8.5 {string trim} {
- string trim " \t\r "
+test string-13.1 {string repeat} {
+ list [catch {string repeat} msg] $msg
+} {1 {wrong # args: should be "string repeat string count"}}
+test string-13.2 {string repeat} {
+ list [catch {string repeat abc 10 oops} msg] $msg
+} {1 {wrong # args: should be "string repeat string count"}}
+test string-13.3 {string repeat} {
+ string repeat {} 100
} {}
-test string-8.6 {string trim} {
- string trim {abcdefg} {}
-} {abcdefg}
-test string-8.7 {string trim} {
- string trim {}
+test string-13.4 {string repeat} {
+ string repeat { } 5
+} { }
+test string-13.5 {string repeat} {
+ string repeat abc 3
+} {abcabcabc}
+test string-13.6 {string repeat} {
+ string repeat abc -1
} {}
-test string-8.8 {string trim} {
- string trim ABC DEF
-} {ABC}
-test string-8.9 {string trim} {
- list [catch {string trim} msg] $msg
-} {1 {wrong # args: should be "string trim string ?chars?"}}
-test string-8.10 {string trim} {
- list [catch {string trim a b c} msg] $msg
-} {1 {wrong # args: should be "string trim string ?chars?"}}
-
-test string-9.1 {string trimleft} {
- string trimleft " XYZ "
-} {XYZ }
-test string-9.2 {string trimleft} {
- list [catch {string trimleft} msg] $msg
-} {1 {wrong # args: should be "string trimleft string ?chars?"}}
+test string-13.7 {string repeat} {
+ list [catch {string repeat abc end} msg] $msg
+} {1 {expected integer but got "end"}}
-test string-10.1 {string trimright} {
- string trimright " XYZ "
-} { XYZ}
-test string-10.2 {string trimright} {
- string trimright " "
+test string-14.1 {string replace} {
+ list [catch {string replace} msg] $msg
+} {1 {wrong # args: should be "string replace string first last ?string?"}}
+test string-14.2 {string replace} {
+ list [catch {string replace a 1} msg] $msg
+} {1 {wrong # args: should be "string replace string first last ?string?"}}
+test string-14.3 {string replace} {
+ list [catch {string replace a 1 2 3 4} msg] $msg
+} {1 {wrong # args: should be "string replace string first last ?string?"}}
+test string-14.4 {string replace} {
} {}
-test string-10.3 {string trimright} {
- string trimright ""
+test string-14.5 {string replace} {
+ string replace abcdefghijklmnop 2 14
+} {abp}
+test string-14.6 {string replace} {
+ string replace abcdefghijklmnop 7 1000
+} {abcdefg}
+test string-14.7 {string replace} {
+ string replace abcdefghijklmnop 10 e
+} {abcdefghij}
+test string-14.8 {string replace} {
+ string replace abcdefghijklmnop 10 9
+} {abcdefghijklmnop}
+test string-14.9 {string replace} {
+ string replace abcdefghijklmnop -3 2
+} {defghijklmnop}
+test string-14.10 {string replace} {
+ string replace abcdefghijklmnop -3 -2
+} {abcdefghijklmnop}
+test string-14.11 {string replace} {
+ string replace abcdefghijklmnop 1000 1010
+} {abcdefghijklmnop}
+test string-14.12 {string replace} {
+ string replace abcdefghijklmnop -100 end
} {}
-test string-10.4 {string trimright errors} {
- list [catch {string trimright} msg] $msg
-} {1 {wrong # args: should be "string trimright string ?chars?"}}
-test string-10.5 {string trimright errors} {
- list [catch {string trimg a} msg] $msg
-} {1 {bad option "trimg": must be bytelength, compare, equal, first, icompare, iequal, index, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
+test string-14.13 {string replace} {
+ list [catch {string replace abc abc 1} msg] $msg
+} {1 {bad index "abc": must be integer or end?-integer?}}
+test string-14.14 {string replace} {
+ list [catch {string replace abc 1 eof} msg] $msg
+} {1 {bad index "eof": must be integer or end?-integer?}}
+test string-14.15 {string replace} {
+ string replace abcdefghijklmnop end-10 end-2 NEW
+} {abcdeNEWop}
+test string-14.16 {string replace} {
+ string replace abcdefghijklmnop 0 e foo
+} {foo}
+test string-14.17 {string replace} {
+ string replace abcdefghijklmnop end end-1
+} {abcdefghijklmnop}
-test string-11.1 {string tolower} {
+test string-15.1 {string tolower too few args} {
+ list [catch {string tolower} msg] $msg
+} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
+test string-15.2 {string tolower bad args} {
+ list [catch {string tolower a b} msg] $msg
+} {1 {bad index "b": must be integer or end?-integer?}}
+test string-15.3 {string tolower too many args} {
+ list [catch {string tolower ABC 1 end oops} msg] $msg
+} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
+test string-15.4 {string tolower} {
string tolower ABCDeF
} {abcdef}
-test string-11.2 {string tolower} {
+test string-15.5 {string tolower} {
string tolower "ABC XyZ"
} {abc xyz}
-test string-11.3 {string tolower} {
+test string-15.6 {string tolower} {
string tolower {123#$&*()}
} {123#$&*()}
-test string-11.4 {string tolower too few args} {
- list [catch {string tolower} msg] $msg
-} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
-test string-11.5 {string tolower bad args} {
- list [catch {string tolower a b} msg] $msg
-} {1 {syntax error in expression "b"}}
-test string-11.6 {string tolower too many args} {
- list [catch {string tolower ABC 1 end oops} msg] $msg
-} {1 {wrong # args: should be "string tolower string ?first? ?last?"}}
-test string-11.7 {string tolower} {
+test string-15.7 {string tolower} {
string tolower ABC 1
} AbC
-test string-11.8 {string tolower} {
+test string-15.8 {string tolower} {
string tolower ABC 1 end
} Abc
-test string-11.9 {string tolower} {
+test string-15.9 {string tolower} {
string tolower ABC 0 end-1
} abC
-test string-11.10 {string tolower called with badly formed Utf string} {
- string tolower [bytestring "\u00fcBER"]
-} [bytestring "\u00fcber"]
-
-test string-12.1 {string totitle} {
- string totitle ABCDeF
-} {Abcdef}
-test string-12.2 {string totitle} {
- string totitle "aBC d Hij xyZ"
-} {Abc d hij xyz}
-test string-12.3 {string totitle} {
- string totitle {123#$&*()}
-} {123#$&*()}
-test string-12.4 {string totitle} {
- list [catch {string totitle} msg] $msg
-} {1 {wrong # args: should be "string totitle string ?first? ?last?"}}
-test string-12.5 {string totitle} {
- list [catch {string totitle a b} msg] $msg
-} {1 {syntax error in expression "b"}}
-test string-12.6 {string totitle too many args} {
- list [catch {string totitle ABC 1 end oops} msg] $msg
-} {1 {wrong # args: should be "string totitle string ?first? ?last?"}}
-test string-12.7 {string totitle} {
- string totitle abC 1
-} aBC
-test string-12.8 {string totitle} {
- string totitle ABC 1 end
-} ABc
-test string-12.9 {string totitle} {
- string totitle ABC 0 end-1
-} AbC
-test string-12.10 {string totitle called with badly formed Utf string} {
- string totitle [bytestring "\u00fcBER"]
-} [bytestring "\u00fcber"]
+test string-15.10 {string tolower, unicode} {
+ string tolower ABCabc\xc7\xe7
+} "abcabc\xe7\xe7"
-test string-13.1 {string toupper} {
+test string-16.1 {string toupper} {
+ list [catch {string toupper} msg] $msg
+} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
+test string-16.2 {string toupper} {
+ list [catch {string toupper a b} msg] $msg
+} {1 {bad index "b": must be integer or end?-integer?}}
+test string-16.3 {string toupper} {
+ list [catch {string toupper a 1 end oops} msg] $msg
+} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
+test string-16.4 {string toupper} {
string toupper abCDEf
} {ABCDEF}
-test string-13.2 {string toupper} {
+test string-16.5 {string toupper} {
string toupper "abc xYz"
} {ABC XYZ}
-test string-13.3 {string toupper} {
+test string-16.6 {string toupper} {
string toupper {123#$&*()}
} {123#$&*()}
-test string-13.4 {string toupper} {
- list [catch {string toupper} msg] $msg
-} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
-test string-13.5 {string toupper} {
- list [catch {string toupper a b} msg] $msg
-} {1 {syntax error in expression "b"}}
-test string-13.6 {string toupper} {
- list [catch {string toupper a 1 end oops} msg] $msg
-} {1 {wrong # args: should be "string toupper string ?first? ?last?"}}
-test string-13.7 {string toupper} {
+test string-16.7 {string toupper} {
string toupper abc 1
} aBc
-test string-13.8 {string toupper} {
+test string-16.8 {string toupper} {
string toupper abc 1 end
} aBC
-test string-13.9 {string toupper} {
+test string-16.9 {string toupper} {
string toupper abc 0 end-1
} ABc
-test string-13.10 {string toupper called with badly formed Utf string} {
- string toupper [bytestring "\u00fcber"]
-} [bytestring "\u00fcBER"]
+test string-16.10 {string toupper, unicode} {
+ string toupper ABCabc\xc7\xe7
+} "ABCABC\xc7\xc7"
+
+test string-17.1 {string totitle} {
+ list [catch {string totitle} msg] $msg
+} {1 {wrong # args: should be "string totitle string ?first? ?last?"}}
+test string-17.2 {string totitle} {
+ list [catch {string totitle a b} msg] $msg
+} {1 {bad index "b": must be integer or end?-integer?}}
+test string-17.3 {string totitle} {
+ string totitle abCDEf
+} {Abcdef}
+test string-17.4 {string totitle} {
+ string totitle "abc xYz"
+} {Abc xyz}
+test string-17.5 {string totitle} {
+ string totitle {123#$&*()}
+} {123#$&*()}
+test string-17.6 {string totitle, unicode} {
+ string totitle ABCabc\xc7\xe7
+} "Abcabc\xe7\xe7"
+test string-17.7 {string totitle, unicode} {
+ string totitle \u01f3BCabc\xc7\xe7
+} "\u01f2bcabc\xe7\xe7"
+
+test string-18.1 {string trim} {
+ list [catch {string trim} msg] $msg
+} {1 {wrong # args: should be "string trim string ?chars?"}}
+test string-18.2 {string trim} {
+ list [catch {string trim a b c} msg] $msg
+} {1 {wrong # args: should be "string trim string ?chars?"}}
+test string-18.3 {string trim} {
+ string trim " XYZ "
+} {XYZ}
+test string-18.4 {string trim} {
+ string trim "\t\nXYZ\t\n\r\n"
+} {XYZ}
+test string-18.5 {string trim} {
+ string trim " A XYZ A "
+} {A XYZ A}
+test string-18.6 {string trim} {
+ string trim "XXYYZZABC XXYYZZ" ZYX
+} {ABC }
+test string-18.7 {string trim} {
+ string trim " \t\r "
+} {}
+test string-18.8 {string trim} {
+ string trim {abcdefg} {}
+} {abcdefg}
+test string-18.9 {string trim} {
+ string trim {}
+} {}
+test string-18.10 {string trim} {
+ string trim ABC DEF
+} {ABC}
+test string-18.11 {string trim, unicode} {
+ string trim "\xe7\xe8 AB\xe7C \xe8\xe7" \xe7\xe8
+} " AB\xe7C "
+
+test string-19.1 {string trimleft} {
+ list [catch {string trimleft} msg] $msg
+} {1 {wrong # args: should be "string trimleft string ?chars?"}}
+test string-19.2 {string trimleft} {
+ string trimleft " XYZ "
+} {XYZ }
+
+test string-20.1 {string trimright errors} {
+ list [catch {string trimright} msg] $msg
+} {1 {wrong # args: should be "string trimright string ?chars?"}}
+test string-20.2 {string trimright errors} {
+ list [catch {string trimg a} msg] $msg
+} {1 {bad option "trimg": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
+test string-20.3 {string trimright} {
+ string trimright " XYZ "
+} { XYZ}
+test string-20.4 {string trimright} {
+ string trimright " "
+} {}
+test string-20.5 {string trimright} {
+ string trimright ""
+} {}
-test string-14.1 {string wordend} {
+test string-21.1 {string wordend} {
list [catch {string wordend a} msg] $msg
} {1 {wrong # args: should be "string wordend string index"}}
-test string-14.2 {string wordend} {
+test string-21.2 {string wordend} {
list [catch {string wordend a b c} msg] $msg
} {1 {wrong # args: should be "string wordend string index"}}
-test string-14.3 {string wordend} {
+test string-21.3 {string wordend} {
list [catch {string wordend a gorp} msg] $msg
-} {1 {syntax error in expression "gorp"}}
-test string-14.4 {string wordend} {
+} {1 {bad index "gorp": must be integer or end?-integer?}}
+test string-21.4 {string wordend} {
string wordend abc. -1
} 3
-test string-14.5 {string wordend} {
+test string-21.5 {string wordend} {
string wordend abc. 100
} 4
-test string-14.6 {string wordend} {
+test string-21.6 {string wordend} {
string wordend "word_one two three" 2
} 8
-test string-14.7 {string wordend} {
+test string-21.7 {string wordend} {
string wordend "one .&# three" 5
} 6
-test string-14.8 {string wordend} {
+test string-21.8 {string wordend} {
string worde "x.y" 0
} 1
-test string-14.9 {string wordend} {
+test string-21.9 {string wordend} {
string worde "x.y" end-1
} 2
+test string-21.10 {string wordend, unicode} {
+ string wordend "xyz\u00c7de fg" 0
+} 6
+test string-21.11 {string wordend, unicode} {
+ string wordend "xyz\uc700de fg" 0
+} 6
+test string-21.12 {string wordend, unicode} {
+ string wordend "xyz\u203fde fg" 0
+} 6
+test string-21.13 {string wordend, unicode} {
+ string wordend "xyz\u2045de fg" 0
+} 3
+test string-21.14 {string wordend, unicode} {
+ string wordend "\uc700\uc700 abc" 8
+} 6
-test string-15.1 {string wordstart} {
+test string-22.1 {string wordstart} {
list [catch {string word a} msg] $msg
-} {1 {ambiguous option "word": must be bytelength, compare, equal, first, icompare, iequal, index, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
-test string-15.2 {string wordstart} {
+} {1 {ambiguous option "word": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
+test string-22.2 {string wordstart} {
list [catch {string wordstart a} msg] $msg
} {1 {wrong # args: should be "string wordstart string index"}}
-test string-15.3 {string wordstart} {
+test string-22.3 {string wordstart} {
list [catch {string wordstart a b c} msg] $msg
} {1 {wrong # args: should be "string wordstart string index"}}
-test string-15.4 {string wordstart} {
+test string-22.4 {string wordstart} {
list [catch {string wordstart a gorp} msg] $msg
-} {1 {syntax error in expression "gorp"}}
-test string-15.5 {string wordstart} {
+} {1 {bad index "gorp": must be integer or end?-integer?}}
+test string-22.5 {string wordstart} {
string wordstart "one two three_words" 400
} 8
-test string-15.6 {string wordstart} {
+test string-22.6 {string wordstart} {
string wordstart "one two three_words" 2
} 0
-test string-15.7 {string wordstart} {
+test string-22.7 {string wordstart} {
string wordstart "one two three_words" -2
} 0
-test string-15.8 {string wordstart} {
+test string-22.8 {string wordstart} {
string wordstart "one .*&^ three" 6
} 6
-test string-15.9 {string wordstart} {
+test string-22.9 {string wordstart} {
string wordstart "one two three" 4
} 4
-test string-15.10 {string wordstart} {
+test string-22.10 {string wordstart} {
string wordstart "one two three" end-5
} 7
-
-test string-16.1 {error conditions} {
- list [catch {string gorp a b} msg] $msg
-} {1 {bad option "gorp": must be bytelength, compare, equal, first, icompare, iequal, index, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}}
-test string-16.2 {error conditions} {
- list [catch {string} msg] $msg
-} {1 {wrong # args: should be "string option arg ?arg ...?"}}
-
-# only need a few tests on equal, since it uses the same code as
-# string compare, but just modifies the return output
-test string-17.1 {string equal} {
- string equal abcde abdef
-} 0
-test string-17.2 {string equal} {
- string eq abcde ABCDE
-} 0
-test string-17.3 {string equal} {
- string equal abcde abcde
-} 1
-
-test string-18.1 {string icompare} {
- string icompare abcde abdef
-} -1
-test string-18.2 {string icompare} {
- string ic abcde ABCDE
-} 0
-test string-18.3 {string icompare} {
- string icompare abcde abcde
-} 0
-test string-18.4 {string icompare too few args} {
- list [catch {string icompare a} msg] $msg
-} {1 {wrong # args: should be "string icompare string1 string2 ?length?"}}
-test string-18.5 {string icompare bad args} {
- list [catch {string icompare a b c} msg] $msg
-} {1 {expected integer but got "c"}}
-test string-18.6 {string icompare too many args} {
- list [catch {string icompare a b 1 c} msg] $msg
-} {1 {wrong # args: should be "string icompare string1 string2 ?length?"}}
-test string-18.7 {string icompare with length} {
- string icompare abcde Abxyz 2
-} 0
-test string-18.8 {string icompare with special index} {
- list [catch {string icompare Abcde abxyz end-3} msg] $msg
-} {1 {expected integer but got "end-3"}}
-
-test string-19.1 {string iequal} {
- string iequal abcde abdef
-} 0
-test string-19.2 {string iequal} {
- string ieq abcde ABCDE
-} 1
-test string-19.3 {string iequal} {
- string iequal abcde abcde
-} 1
-
-test string-20.1 {string map} {
- list [catch {string map} msg] $msg
-} {1 {wrong # args: should be "string map charMap string"}}
-test string-20.2 {string map} {
- list [catch {string map {a b} abba oops} msg] $msg
-} {1 {wrong # args: should be "string map charMap string"}}
-test string-20.3 {string map} {
- string map {a b} abba
-} {bbbb}
-test string-20.4 {string map} {
- string map {abc 321 ab * a A} aabcabaababcab
-} {A321*A*321*}
-test string-20.5 {string map} {
- list [catch {string map {a b c} abba} msg] $msg
-} {1 {char map list unbalanced}}
-test string-20.6 {string map} {
- string map {\x00 NULL blah \x00nix} {qwerty}
-} {qwerty}
-
-test string-21.1 {string repeat} {
- list [catch {string repeat} msg] $msg
-} {1 {wrong # args: should be "string repeat string count"}}
-test string-21.2 {string repeat} {
- list [catch {string repeat abc 10 oops} msg] $msg
-} {1 {wrong # args: should be "string repeat string count"}}
-test string-21.3 {string repeat} {
- string repeat {} 100
-} {}
-test string-21.4 {string repeat} {
- string repeat { } 5
-} { }
-test string-21.5 {string repeat} {
- string repeat abc 3
-} {abcabcabc}
-test string-21.6 {string repeat} {
- string repeat abc -1
-} {}
-test string-21.7 {string repeat} {
- list [catch {string repeat abc end} msg] $msg
-} {1 {expected integer but got "end"}}
-
-test string-22.1 {string replace} {
-} {}
-test string-22.2 {string replace} {
- string replace abcdefghijklmnop 2 14
-} {abp}
-test string-22.3 {string replace} {
- string replace abcdefghijklmnop 7 1000
-} {abcdefg}
-test string-22.4 {string replace} {
- string replace abcdefghijklmnop 10 e
-} {abcdefghij}
-test string-22.5 {string replace} {
- string replace abcdefghijklmnop 10 9
-} {abcdefghijklmnop}
-test string-22.6 {string replace} {
- string replace abcdefghijklmnop -3 2
-} {defghijklmnop}
-test string-22.7 {string replace} {
- string replace abcdefghijklmnop -3 -2
-} {abcdefghijklmnop}
-test string-22.8 {string replace} {
- string replace abcdefghijklmnop 1000 1010
-} {abcdefghijklmnop}
-test string-22.9 {string replace} {
- string replace abcdefghijklmnop -100 end
-} {}
-test string-22.10 {string replace} {
- list [catch {string replace} msg] $msg
-} {1 {wrong # args: should be "string replace string first last ?string?"}}
-test string-22.11 {string replace} {
- list [catch {string replace a 1} msg] $msg
-} {1 {wrong # args: should be "string replace string first last ?string?"}}
-test string-22.12 {string replace} {
- list [catch {string replace a 1 2 3 4} msg] $msg
-} {1 {wrong # args: should be "string replace string first last ?string?"}}
-test string-22.13 {string replace} {
- list [catch {string replace abc abc 1} msg] $msg
-} {1 {syntax error in expression "abc"}}
-test string-22.14 {string replace} {
- list [catch {string replace abc 1 eof} msg] $msg
-} {1 {syntax error in expression "eof"}}
-test string-22.15 {string replace} {
- string replace abcdefghijklmnop end-10 end-2 NEW
-} {abcdeNEWop}
-test string-22.16 {string replace} {
- string replace abcdefghijklmnop 0 e foo
-} {foo}
-test string-22.17 {string replace} {
- string replace abcdefghijklmnop end end-1
-} {abcdefghijklmnop}
+test string-22.11 {string wordstart, unicode} {
+ string wordstart "one tw\u00c7o three" 7
+} 4
+test string-22.12 {string wordstart, unicode} {
+ string wordstart "ab\uc700\uc700 cdef ghi" 12
+} 10
+test string-22.13 {string wordstart, unicode} {
+ string wordstart "\uc700\uc700 abc" 8
+} 3
# cleanup
::tcltest::cleanupTests
@@ -619,12 +978,3 @@ return
-
-
-
-
-
-
-
-
-