1 source [file dirname [info script]]/testing.tcl
5 test utf8-1.1 "Pattern matching - ?" {
6 string match "abc?def" "abc\u00b5def"
9 test utf8-1.2 "Pattern matching - ?" {
10 string match "abc?def" "abc\u2704def"
13 test utf8-1.3 "Pattern utf-8 literal" {
14 string match "ab\u00b5\u2704?" "ab\u00b5\u2704x"
17 test utf8-1.4 "Pattern utf-8 char sets" {
18 string match "a\[b\u00b5\]\u2704?" "a\u00b5\u2704x"
21 test utf8-1.5 "Pattern utf-8 char sets" {
22 string match "a\[b\u00b5\]\u2704?" "a\u00b6\u2704x"
24 test utf8-1.6 "Pattern utf-8 char sets" {
25 string match "a\[b\u00b5\]\u2704?" "ab\u2704x"
27 test utf8-1.7 "Pattern utf-8 char sets" {
28 string match "a\[b\u00b5\]?" "a\u2704x"
30 test utf8-1.8 "Pattern utf-8 char sets" {
31 string match "a\[\u00b5-\u00c3\]" "a\ubd"
33 test utf8-1.9 "Pattern utf-8 char sets" {
34 string match "a\[\u00b5-\u00c3\]" "a\uc4"
37 test utf8-2.1 "Pattern utf-8 nocase" {
38 string match -nocase "a\u1edc\u1ef4*" "A\u1edd\u1ef5XX"
41 test utf8-2.2 "Pattern utf-8 case difference" {
42 string match "a\u1edc\u1ef4*" "A\u1edd\u1ef5XX"
45 test utf8-3.1 "lsearch -glob" {
46 lsearch -glob {1 d a\u00b5xyb c} a\ub5*b
49 test utf8-3.2 "switch -glob" {
50 switch -glob -- a\ub5xyb a\ub5*b { set x 1 } default { set x 0 }
55 test utf8-3.3 "info procs" {
56 proc $x {} { info procs \[\ub5X]???? }
60 test utf8-3.3 "info commands" {
61 info commands \[\ub5X]????
64 test utf8-3.4 "proc name with invalid utf-8" {
65 catch { proc ab\xc2 {} {} } msg
68 test utf8-3.5 "rename to invalid name" {
69 catch { rename ab\xc2 ab\xc3 } msg
72 catch {rename ab\xc3 ""}
74 test utf8-4.1 "split with utf-8" {
78 test utf8-4.2 "split with utf-8" {
79 split "zy\u2702xw" \u2702
82 test utf8-4.2 "split with utf-8" {
86 test utf8-5.1 "string first with utf-8" {
87 string first w "zy\u2702xw"
90 test utf8-5.2 "string first with utf-8" {
91 string first \u2702 "\ub5zy\u2702xw"
94 test utf8-5.3 "string first with utf-8" {
95 string first \u2704 "\ub5zy\u2702xw"
98 test utf8-5.4 "string first with utf-8" {
99 string first \u2702 "\ub5zy\u2702xw\u2702BB"
102 test utf8-6.1 "string last with utf-8" {
103 string last w "zy\u2702xw"
106 test utf8-6.2 "string last with utf-8" {
107 string last \u2702 "\ub5zy\u2702xw"
110 test utf8-6.3 "string last with utf-8" {
111 string last \u2704 "\ub5zy\u2702xw"
114 test utf8-6.4 "string last with utf-8" {
115 string last \u2702 "\ub5zy\u2702xw\u2702BB"
118 test utf8-7.1 "string reverse" {
119 string reverse \ub5Test\u2702
122 test utf8-7.2 {append counts correctly} {
125 list [string length $x] [string bytelength $x]
128 test utf8-7.3 {Upper, lower for titlecase utf-8} {
129 list [string toupper \u01c5] [string tolower \u01c5]
132 test utf8-7.4 {Case folding may change encoded length} {
133 list [string bytelength \u0131] [string bytelength [string toupper \u0131]]
136 test utf8-8.1 {Chars outside the BMP} jim {
137 string length \u{12000}\u{13000}
140 test utf8-8.2 {Chars outside the BMP} jim {
141 string match "ab\[\u{12000}c\]d" ab\u{12000}d
144 test utf8-8.3 {Chars outside the BMP} jim {
145 string last d "ab\u{101fff}cd"
148 test utf8-8.4 {Longer sequences} {
149 string length \u12000