diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-03 12:58:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-03 12:58:25 (GMT) |
commit | c4990c8bf68c57affbfce84c5a261e23db2a7b5e (patch) | |
tree | 746683c0bb840bf197fad1424a4f483b4bfb8771 | |
parent | 3c7bb58fb953270618d9ddd63057ba42bda4907a (diff) | |
parent | 9e0083e9f07d37493c802ab11661736fa680e12c (diff) | |
download | tcl-c4990c8bf68c57affbfce84c5a261e23db2a7b5e.zip tcl-c4990c8bf68c57affbfce84c5a261e23db2a7b5e.tar.gz tcl-c4990c8bf68c57affbfce84c5a261e23db2a7b5e.tar.bz2 |
Merge 8.6
-rw-r--r-- | generic/tclParse.c | 21 | ||||
-rw-r--r-- | tests/string.test | 150 | ||||
-rw-r--r-- | tests/utf.test | 99 |
3 files changed, 139 insertions, 131 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index e786a6f..6143cb7 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -816,7 +816,7 @@ TclParseBackslash( count = 2; switch (*p) { /* - * Note: in the conversions below, use absolute values (e.g., 0xa) + * Note: in the conversions below, use absolute values (e.g., 0xA) * rather than symbolic values (e.g. \n) that get converted by the * compiler. It's possible that compilers on some platforms will do * the symbolic conversions differently, which could result in @@ -830,19 +830,19 @@ TclParseBackslash( result = 0x8; break; case 'f': - result = 0xc; + result = 0xC; break; case 'n': - result = 0xa; + result = 0xA; break; case 'r': - result = 0xd; + result = 0xD; break; case 't': result = 0x9; break; case 'v': - result = 0xb; + result = 0xB; break; case 'x': count += TclParseHex(p+1, (numBytes > 3) ? 2 : numBytes-2, &result); @@ -866,11 +866,13 @@ TclParseBackslash( * No hexdigits -> This is just "u". */ result = 'u'; - } else if (((result & 0xDC00) == 0xD800) && (count == 6) && (p[5] == '\\') && (p[6] == 'u') && (numBytes >= 10)) { - /* If high surrogate is immediately followed by a low surrogate escape, combine them. */ + } else if (((result & 0xDC00) == 0xD800) && (count == 6) + && (p[5] == '\\') && (p[6] == 'u') && (numBytes >= 10)) { + /* If high surrogate is immediately followed by a low surrogate + * escape, combine them into one character. */ int low; int count2 = TclParseHex(p+7, 4, &low); - if ((low & 0xDC00) == 0xDC00) { + if ((count2 == 4) && ((low & 0xDC00) == 0xDC00)) { result = ((result & 0x3FF)<<10 | (low & 0x3FF)) + 0x10000; count += count2 + 2; } @@ -883,6 +885,9 @@ TclParseBackslash( * No hexdigits -> This is just "U". */ result = 'U'; + } else if ((result | 0x7FF) == 0xDFFF) { + /* Upper or lower surrogate, not allowed in this syntax. */ + result = 0xFFFD; } break; case '\n': diff --git a/tests/string.test b/tests/string.test index f077164..e15787a 100644 --- a/tests/string.test +++ b/tests/string.test @@ -121,10 +121,10 @@ test string-2.11.$noComp {string compare, unicode} { run {string compare ab\u7266 ab\u7267} } -1 test string-2.11.1.$noComp {string compare, unicode} { - run {string compare \334 \u00dc} + run {string compare \334 \xDC} } 0 test string-2.11.2.$noComp {string compare, unicode} { - run {string compare \334 \u00fc} + run {string compare \334 \xFC} } -1 test string-2.11.3.$noComp {string compare, unicode} { run {string compare \334\334\334\374\374 \334\334\334\334\334} @@ -151,10 +151,10 @@ test string-2.15.$noComp {string compare -nocase} { run {string compare -nocase abcde abcde} } 0 test string-2.15.1.$noComp {string compare -nocase} { - run {string compare -nocase \334 \u00dc} + run {string compare -nocase \334 \xDC} } 0 test string-2.15.2.$noComp {string compare -nocase} { - run {string compare -nocase \334\334\334\374\u00fc \334\334\334\334\334} + run {string compare -nocase \334\334\334\374\xFC \334\334\334\334\334} } 0 test string-2.16.$noComp {string compare -nocase with length} { run {string compare -length 2 -nocase abcde Abxyz} @@ -276,10 +276,10 @@ test string-3.16.$noComp {string equal, unicode} { run {string equal ab\u7266 ab\u7267} } 0 test string-3.17.$noComp {string equal, unicode} { - run {string equal \334 \u00dc} + run {string equal \334 \xDC} } 1 test string-3.18.$noComp {string equal, unicode} { - run {string equal \334 \u00fc} + run {string equal \334 \xFC} } 0 test string-3.19.$noComp {string equal, unicode} { run {string equal \334\334\334\374\374 \334\334\334\334\334} @@ -297,10 +297,10 @@ test string-3.21.$noComp {string equal -nocase} { run {string equal -nocase abcde Abdef} } 0 test string-3.22.$noComp {string equal, -nocase unicode} { - run {string equal -nocase \334 \u00dc} + run {string equal -nocase \334 \xDC} } 1 test string-3.23.$noComp {string equal, -nocase unicode} { - run {string equal -nocase \334\334\334\374\u00fc \334\334\334\334\334} + run {string equal -nocase \334\334\334\374\xFC \334\334\334\334\334} } 1 test string-3.24.$noComp {string equal -nocase with length} { run {string equal -length 2 -nocase abcde Abxyz} @@ -411,7 +411,7 @@ test string-4.15.$noComp {string first, ability to two-byte encoded utf-8 chars} # Test for a bug in Tcl 8.3 where test for all-single-byte-encoded # strings was incorrect, leading to an index returned by [string first] # which pointed past the end of the string. - set uchar \u057e ;# character with two-byte encoding in utf-8 + set uchar \u057E ;# character with two-byte encoding in utf-8 run {string first % %#$uchar$uchar#$uchar$uchar#% 3} } 8 test string-4.16.$noComp {string first, normal string vs pure unicode string} { @@ -559,7 +559,7 @@ test string-6.12.$noComp {string is alnum, true} { test string-6.13.$noComp {string is alnum, false} { list [run {string is alnum -failindex var abc1.23}] $var } {0 4} -test string-6.14.$noComp {string is alnum, unicode} "run {string is alnum abc\xfc}" 1 +test string-6.14.$noComp {string is alnum, unicode} "run {string is alnum abc\xFC}" 1 test string-6.15.$noComp {string is alpha, true} { run {string is alpha abc} } 1 @@ -570,10 +570,10 @@ test string-6.17.$noComp {string is alpha, unicode} { run {string is alpha abc\374} } 1 test string-6.18.$noComp {string is ascii, true} { - run {string is ascii abc\u007Fend\u0000} + run {string is ascii abc\x7Fend\x00} } 1 test string-6.19.$noComp {string is ascii, false} { - list [run {string is ascii -fail var abc\u0000def\u0080more}] $var + list [run {string is ascii -fail var abc\x00def\x80more}] $var } {0 7} test string-6.20.$noComp {string is boolean, true} { run {string is boolean true} @@ -591,7 +591,7 @@ test string-6.24.$noComp {string is digit, true} { run {string is digit 0123456789} } 1 test string-6.25.$noComp {string is digit, false} { - list [run {string is digit -fail var 0123\u00dc567}] $var + list [run {string is digit -fail var 0123\xDC567}] $var } {0 4} test string-6.26.$noComp {string is digit, false} { list [run {string is digit -fail var +123567}] $var @@ -714,7 +714,7 @@ test string-6.60.$noComp {string is lower, true} { run {string is lower abc} } 1 test string-6.61.$noComp {string is lower, unicode true} { - run {string is lower abc\u00fcue} + run {string is lower abc\xFCue} } 1 test string-6.62.$noComp {string is lower, false} { list [run {string is lower -fail var aBc}] $var @@ -723,7 +723,7 @@ test string-6.63.$noComp {string is lower, false} { list [run {string is lower -fail var abc1}] $var } {0 3} test string-6.64.$noComp {string is lower, unicode false} { - list [run {string is lower -fail var ab\u00dcUE}] $var + list [run {string is lower -fail var ab\xDCUE}] $var } {0 2} test string-6.65.$noComp {string is space, true} { run {string is space " \t\n\v\f"} @@ -761,7 +761,7 @@ test string-6.75.$noComp {string is upper, true} { run {string is upper ABC} } 1 test string-6.76.$noComp {string is upper, unicode true} { - run {string is upper ABC\u00dcUE} + run {string is upper ABC\xDCUE} } 1 test string-6.77.$noComp {string is upper, false} { list [run {string is upper -fail var AbC}] $var @@ -770,19 +770,19 @@ test string-6.78.$noComp {string is upper, false} { list [run {string is upper -fail var AB2C}] $var } {0 2} test string-6.79.$noComp {string is upper, unicode false} { - list [run {string is upper -fail var ABC\u00fcue}] $var + list [run {string is upper -fail var ABC\xFCue}] $var } {0 3} test string-6.80.$noComp {string is wordchar, true} { run {string is wordchar abc_123} } 1 test string-6.81.$noComp {string is wordchar, unicode true} { - run {string is wordchar abc\u00fcab\u00dcAB\u5001} + run {string is wordchar abc\xFCab\xDCAB\u5001} } 1 test string-6.82.$noComp {string is wordchar, false} { list [run {string is wordchar -fail var abcd.ef}] $var } {0 4} test string-6.83.$noComp {string is wordchar, unicode false} { - list [run {string is wordchar -fail var abc\u0080def}] $var + list [run {string is wordchar -fail var abc\x80def}] $var } {0 3} test string-6.84.$noComp {string is control} { ## Control chars are in the ranges @@ -798,14 +798,14 @@ test string-6.86.$noComp {string is graph} { } {0 14} test string-6.87.$noComp {string is print} { ## basically any printable char - list [run {string is print -fail var "0123abc!@#\$\u0100 \UE0100\UE01EF\u0010"}] $var + list [run {string is print -fail var "0123abc!@#\$\u0100 \UE0100\UE01EF\x10"}] $var } {0 15} test string-6.88.$noComp {string is punct} { ## any graph char that isn't alnum - list [run {string is punct -fail var "_!@#\u00beq0"}] $var + list [run {string is punct -fail var "_!@#\xBEq0"}] $var } {0 4} test string-6.89.$noComp {string is xdigit} { - list [run {string is xdigit -fail var 0123456789\u0061bcdefABCDEFg}] $var + list [run {string is xdigit -fail var 0123456789\x61bcdefABCDEFg}] $var } {0 22} test string-6.90.$noComp {string is integer, bad integers} { @@ -895,7 +895,7 @@ test string-6.108.$noComp {string is double, Bug 1382287} { run {string is double $x} } 0 test string-6.109.$noComp {string is double, Bug 1360532} { - run {string is double 1\u00a0} + run {string is double 1\xA0} } 0 test string-6.110.$noComp {string is entier, true} { run {string is entier +1234567890} @@ -1030,7 +1030,7 @@ test string-8.2.$noComp {string bytelength} { list [catch {run {string bytelength a b}} msg] $msg } {1 {wrong # args: should be "string bytelength string"}} test string-8.3.$noComp {string bytelength} { - run {string bytelength "\u00c7"} + run {string bytelength "\xC7"} } 2 test string-8.4.$noComp {string bytelength} { run {string b ""} @@ -1378,7 +1378,7 @@ test string-11.51.$noComp {string match; *, -nocase and UTF-8} { test string-11.52.$noComp {string match, null char in string} { set out "" set ptn "*abc*" - foreach elem [list "\u0000@abc" "@abc" "\u0000@abc\u0000" "blahabcblah"] { + foreach elem [list "\x00@abc" "@abc" "\x00@abc\x00" "blahabcblah"] { lappend out [run {string match $ptn $elem}] } set out @@ -1386,11 +1386,11 @@ test string-11.52.$noComp {string match, null char in string} { test string-11.53.$noComp {string match, null char in pattern} { set out "" foreach {ptn elem} [list \ - "*\u0000abc\u0000" "\u0000abc\u0000" \ - "*\u0000abc\u0000" "\u0000abc\u0000ef" \ - "*\u0000abc\u0000*" "\u0000abc\u0000ef" \ - "*\u0000abc\u0000" "@\u0000abc\u0000ef" \ - "*\u0000abc\u0000*" "@\u0000abc\u0000ef" \ + "*\x00abc\x00" "\x00abc\x00" \ + "*\x00abc\x00" "\x00abc\x00ef" \ + "*\x00abc\x00*" "\x00abc\x00ef" \ + "*\x00abc\x00" "@\x00abc\x00ef" \ + "*\x00abc\x00*" "@\x00abc\x00ef" \ ] { lappend out [run {string match $ptn $elem}] } @@ -1399,14 +1399,14 @@ test string-11.53.$noComp {string match, null char in pattern} { test string-11.54.$noComp {string match, failure} { set longString "" for {set i 0} {$i < 10} {incr i} { - append longString "abcdefghijklmnopqrstuvwxy\u0000z01234567890123" + append longString "abcdefghijklmnopqrstuvwxy\x00z01234567890123" } run {string first $longString 123} list [run {string match *cba* $longString}] \ - [run {string match *a*l*\u0000* $longString}] \ - [run {string match *a*l*\u0000*123 $longString}] \ - [run {string match *a*l*\u0000*123* $longString}] \ - [run {string match *a*l*\u0000*cba* $longString}] \ + [run {string match *a*l*\x00* $longString}] \ + [run {string match *a*l*\x00*123 $longString}] \ + [run {string match *a*l*\x00*123* $longString}] \ + [run {string match *a*l*\x00*cba* $longString}] \ [run {string match *===* $longString}] } {0 1 1 1 0 0} test string-11.55.$noComp {string match, invalid binary optimization} { @@ -1479,8 +1479,8 @@ test string-12.19.$noComp {string range, bytearray object} { run {string equal $r1 $r2} } 1 test string-12.20.$noComp {string range, out of bounds indices} { - run {string range \u00ff 0 1} -} \u00ff + run {string range \xFF 0 1} +} \xFF # Bug 1410553 test string-12.21.$noComp {string range, regenerates correct reps, bug 1410553} { set bytes "\x00 \x03 \x41" @@ -1648,7 +1648,7 @@ test stringComp-14.24.$noComp {Bug 1af8de570511} { }} 4 x } 0x00 test stringComp-14.25.$noComp {} { - string length [string replace [string repeat a\u00fe 2] 3 end {}] + string length [string replace [string repeat a\xFE 2] 3 end {}] } 3 test string-15.1.$noComp {string tolower too few args} { @@ -1679,8 +1679,8 @@ test string-15.9.$noComp {string tolower} { run {string tolower ABC 0 end-1} } abC test string-15.10.$noComp {string tolower, unicode} { - run {string tolower ABCabc\xc7\xe7} -} "abcabc\xe7\xe7" + run {string tolower ABCabc\xC7\xE7} +} "abcabc\xE7\xE7" test string-15.11.$noComp {string tolower, compiled} { lindex [run {string tolower [list A B [list C]]}] 1 } b @@ -1713,8 +1713,8 @@ test string-16.9.$noComp {string toupper} { run {string toupper abc 0 end-1} } ABc test string-16.10.$noComp {string toupper, unicode} { - run {string toupper ABCabc\xc7\xe7} -} "ABCABC\xc7\xc7" + run {string toupper ABCabc\xC7\xE7} +} "ABCABC\xC7\xC7" test string-16.11.$noComp {string toupper, compiled} { lindex [run {string toupper [list a b [list c]]}] 1 } B @@ -1735,11 +1735,11 @@ test string-17.5.$noComp {string totitle} { run {string totitle {123#$&*()}} } {123#$&*()} test string-17.6.$noComp {string totitle, unicode} { - run {string totitle ABCabc\xc7\xe7} -} "Abcabc\xe7\xe7" + run {string totitle ABCabc\xC7\xE7} +} "Abcabc\xE7\xE7" test string-17.7.$noComp {string totitle, unicode} { - run {string totitle \u01f3BCabc\xc7\xe7} -} "\u01f2bcabc\xe7\xe7" + run {string totitle \u01F3BCabc\xC7\xE7} +} "\u01F2bcabc\xE7\xE7" test string-17.8.$noComp {string totitle, compiled} { lindex [run {string totitle [list aa bb [list cc]]}] 0 } Aa @@ -1779,10 +1779,10 @@ test string-18.10.$noComp {string trim} { run {string trim ABC DEF} } {ABC} test string-18.11.$noComp {string trim, unicode} { - run {string trim "\xe7\xe8 AB\xe7C \xe8\xe7" \xe7\xe8} -} " AB\xe7C " + run {string trim "\xE7\xE8 AB\xE7C \xE8\xE7" \xE7\xE8} +} " AB\xE7C " test string-18.12.$noComp {string trim, unicode default} { - run {string trim \ufeff\x00\u0085\u00a0\u1680\u180eABC\u1361\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000} + run {string trim \uFEFF\x00\x85\xA0\u1680\u180EABC\u1361\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2028\u2029\u202F\u205F\u3000} } ABC\u1361 test string-19.1.$noComp {string trimleft} { @@ -1792,7 +1792,7 @@ test string-19.2.$noComp {string trimleft} { run {string trimleft " XYZ "} } {XYZ } test string-19.3.$noComp {string trimleft, unicode default} { - run {string trimleft \ufeff\u0085\u00a0\x00\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000\u1361ABC} + run {string trimleft \uFEFF\x85\xA0\x00\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2028\u2029\u202F\u205F\u3000\u1361ABC} } \u1361ABC test string-20.1.$noComp {string trimright errors} { @@ -1811,7 +1811,7 @@ test string-20.5.$noComp {string trimright} { run {string trimright ""} } {} test string-20.6.$noComp {string trimright, unicode default} { - run {string trimright ABC\u1361\u0085\x00\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000} + run {string trimright ABC\u1361\x85\x00\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2028\u2029\u202F\u205F\u3000} } ABC\u1361 test string-21.1.$noComp {string wordend} { @@ -1842,19 +1842,19 @@ test string-21.9.$noComp {string wordend} { run {string worde "x.y" end-1} } 2 test string-21.10.$noComp {string wordend, unicode} { - run {string wordend "xyz\u00c7de fg" 0} + run {string wordend "xyz\xC7de fg" 0} } 6 test string-21.11.$noComp {string wordend, unicode} { - run {string wordend "xyz\uc700de fg" 0} + run {string wordend "xyz\uC700de fg" 0} } 6 test string-21.12.$noComp {string wordend, unicode} { - run {string wordend "xyz\u203fde fg" 0} + run {string wordend "xyz\u203Fde fg" 0} } 6 test string-21.13.$noComp {string wordend, unicode} { run {string wordend "xyz\u2045de fg" 0} } 3 test string-21.14.$noComp {string wordend, unicode} { - run {string wordend "\uc700\uc700 abc" 8} + run {string wordend "\uC700\uC700 abc" 8} } 6 test string-22.1.$noComp {string wordstart} { @@ -1888,13 +1888,13 @@ test string-22.10.$noComp {string wordstart} { run {string wordstart "one two three" end-5} } 7 test string-22.11.$noComp {string wordstart, unicode} { - run {string wordstart "one tw\u00c7o three" 7} + run {string wordstart "one tw\xC7o three" 7} } 4 test string-22.12.$noComp {string wordstart, unicode} { - run {string wordstart "ab\uc700\uc700 cdef ghi" 12} + run {string wordstart "ab\uC700\uC700 cdef ghi" 12} } 10 test string-22.13.$noComp {string wordstart, unicode} { - run {string wordstart "\uc700\uc700 abc" 8} + run {string wordstart "\uC700\uC700 abc" 8} } 3 test string-23.0.$noComp {string is boolean, Bug 1187123} testindexobj { @@ -1965,40 +1965,40 @@ test string-24.4.$noComp {string reverse command - unshared string} { run {string reverse $x$y} } edcba test string-24.5.$noComp {string reverse command - shared unicode string} { - set x abcde\ud0ad + set x abcde\uD0AD run {string reverse $x} -} \ud0adedcba +} \uD0ADedcba test string-24.6.$noComp {string reverse command - unshared string} { set x abc - set y de\ud0ad + set y de\uD0AD run {string reverse $x$y} -} \ud0adedcba +} \uD0ADedcba test string-24.7.$noComp {string reverse command - simple case} { run {string reverse a} } a test string-24.8.$noComp {string reverse command - simple case} { - run {string reverse \ud0ad} -} \ud0ad + run {string reverse \uD0AD} +} \uD0AD test string-24.9.$noComp {string reverse command - simple case} { run {string reverse {}} } {} test string-24.10.$noComp {string reverse command - corner case} { - set x \ubeef\ud0ad + set x \uBEEF\uD0AD run {string reverse $x} -} \ud0ad\ubeef +} \uD0AD\uBEEF test string-24.11.$noComp {string reverse command - corner case} { - set x \ubeef - set y \ud0ad + set x \uBEEF + set y \uD0AD run {string reverse $x$y} -} \ud0ad\ubeef +} \uD0AD\uBEEF test string-24.12.$noComp {string reverse command - corner case} { - set x \ubeef - set y \ud0ad + set x \uBEEF + set y \uD0AD run {string is ascii [run {string reverse $x$y}]} } 0 test string-24.13.$noComp {string reverse command - pure Unicode string} { - run {string reverse [run {string range \ubeef\ud0ad\ubeef\ud0ad\ubeef\ud0ad 1 5}]} -} \ud0ad\ubeef\ud0ad\ubeef\ud0ad + run {string reverse [run {string range \uBEEF\uD0AD\uBEEF\uD0AD\uBEEF\uD0AD 1 5}]} +} \uD0AD\uBEEF\uD0AD\uBEEF\uD0AD test string-24.14.$noComp {string reverse command - pure bytearray} { binary scan [run {string reverse [binary format H* 010203]}] H* x set x @@ -2054,7 +2054,7 @@ test string-25.13.$noComp {string is list} { } {0 2} test string-25.14.$noComp {string is list} { set x {} - list [run {string is list -failindex x "\uabcd {b c}d e"}] $x + list [run {string is list -failindex x "\uABCD {b c}d e"}] $x } {0 2} test string-26.1.$noComp {tcl::prefix, too few args} -body { @@ -2475,7 +2475,7 @@ test string-32.13.$noComp {string is dict} { } {0 2} test string-32.14.$noComp {string is dict} { set x {} - list [string is dict -failindex x "\uabcd {b c}d e"] $x + list [string is dict -failindex x "\uABCD {b c}d e"] $x } {0 2} test string-32.15.$noComp {string is dict, valid dict} { string is dict {a b c d e f} diff --git a/tests/utf.test b/tests/utf.test index 0f53b38..f830110 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -59,6 +59,9 @@ test utf-1.11 {Tcl_UniCharToUtf: 3 byte sequence, low surrogate} testbytestring test utf-1.12 {Tcl_UniCharToUtf: 4 byte sequence, high/low surrogate} testbytestring { expr {"\uD842\uDC42" eq [testbytestring "\xF0\xA0\xA1\x82"]} } 1 +test utf-1.13 {Tcl_UniCharToUtf: Invalid surrogate} testbytestring { + expr {"\UD842" eq [testbytestring "\xEF\xBF\xBD"]} +} 1 test utf-2.1 {Tcl_UtfToUniChar: low ascii} { string length "abc" @@ -160,13 +163,13 @@ test utf-8.3 {Tcl_UniCharAtIndex: index > 0} { } {c} test utf-8.4 {Tcl_UniCharAtIndex: index > 0} { string index \u4E4E\u25A\xFF\u543 2 -} "\uff" +} "\uFF" test utf-8.5 {Tcl_UniCharAtIndex: high surrogate} { - string index \ud842 0 -} "\ud842" + string index \uD842 0 +} "\uD842" test utf-8.6 {Tcl_UniCharAtIndex: low surrogate} { - string index \udc42 0 -} "\udc42" + string index \uDC42 0 +} "\uDC42" test utf-9.1 {Tcl_UtfAtIndex: index = 0} { string range abcd 0 2 @@ -193,10 +196,10 @@ test utf-10.5 {Tcl_UtfBackslash: stops after 4 hex chars} testbytestring { expr {"\u4E216" eq "[testbytestring \xE4\xB8\xA1]6"} } 1 test utf-10.6 {Tcl_UtfBackslash: stops after 5 hex chars} testbytestring { - expr {"\U1e2165" eq "[testbytestring \xf0\x9e\x88\x96]5"} + expr {"\U1E2165" eq "[testbytestring \xF0\x9E\x88\x96]5"} } 1 test utf-10.7 {Tcl_UtfBackslash: stops after 6 hex chars} testbytestring { - expr {"\U10e2165" eq "[testbytestring \xf4\x8e\x88\x96]5"} + expr {"\U10E2165" eq "[testbytestring \xF4\x8E\x88\x96]5"} } 1 proc bsCheck {char num} { global errNum @@ -270,17 +273,17 @@ test utf-11.2 {Tcl_UtfToUpper} { string toupper abc } ABC test utf-11.3 {Tcl_UtfToUpper} { - string toupper \u00E3ab -} \u00C3AB + string toupper \xE3AB +} \xC3AB test utf-11.4 {Tcl_UtfToUpper} { - string toupper \u01E3ab + string toupper \u01E3AB } \u01E2AB test utf-11.5 {Tcl_UtfToUpper Georgian (new in Unicode 11)} { string toupper \u10D0\u1C90 } \u1C90\u1C90 test utf-11.6 {Tcl_UtfToUpper low/high surrogate)} { - string toupper \udc24\ud824 -} \udc24\ud824 + string toupper \uDC24\uD824 +} \uDC24\uD824 test utf-12.1 {Tcl_UtfToLower} { string tolower {} @@ -289,8 +292,8 @@ test utf-12.2 {Tcl_UtfToLower} { string tolower ABC } abc test utf-12.3 {Tcl_UtfToLower} { - string tolower \u00C3AB -} \u00E3ab + string tolower \xC3AB +} \xE3ab test utf-12.4 {Tcl_UtfToLower} { string tolower \u01E2AB } \u01E3ab @@ -298,8 +301,8 @@ test utf-12.5 {Tcl_UtfToLower Georgian (new in Unicode 11)} { string tolower \u10D0\u1C90 } \u10D0\u10D0 test utf-12.6 {Tcl_UtfToUpper low/high surrogate)} { - string tolower \udc24\ud824 -} \udc24\ud824 + string tolower \uDC24\uD824 +} \uDC24\uD824 test utf-13.1 {Tcl_UtfToTitle} { string totitle {} @@ -308,10 +311,10 @@ test utf-13.2 {Tcl_UtfToTitle} { string totitle abc } Abc test utf-13.3 {Tcl_UtfToTitle} { - string totitle \u00E3ab -} \u00C3ab + string totitle \xE3AB +} \xC3ab test utf-13.4 {Tcl_UtfToTitle} { - string totitle \u01F3ab + string totitle \u01F3AB } \u01F2ab test utf-13.5 {Tcl_UtfToTitle Georgian (new in Unicode 11)} { string totitle \u10D0\u1C90 @@ -320,8 +323,8 @@ test utf-13.6 {Tcl_UtfToTitle Georgian (new in Unicode 11)} { string totitle \u1C90\u10D0 } \u1C90\u10D0 test utf-13.7 {Tcl_UtfToTitle low/high surrogate)} { - string totitle \udc24\ud824 -} \udc24\ud824 + string totitle \uDC24\uD824 +} \uDC24\uD824 test utf-14.1 {Tcl_UtfNcasecmp} { string compare -nocase a b @@ -340,7 +343,7 @@ test utf-15.1 {Tcl_UniCharToUpper, negative delta} { string toupper aA } AA test utf-15.2 {Tcl_UniCharToUpper, positive delta} { - string toupper \u0178\u00ff + string toupper \u0178\xFF } \u0178\u0178 test utf-15.3 {Tcl_UniCharToUpper, no delta} { string toupper ! @@ -350,24 +353,24 @@ test utf-16.1 {Tcl_UniCharToLower, negative delta} { string tolower aA } aa test utf-16.2 {Tcl_UniCharToLower, positive delta} { - string tolower \u0178\u00ff\uA78D\u01c5\U10400 -} \u00ff\u00ff\u0265\u01c6\U10428 + string tolower \u0178\xFF\uA78D\u01C5\U10400 +} \xFF\xFF\u0265\u01C6\U10428 test utf-17.1 {Tcl_UniCharToLower, no delta} { string tolower ! } ! test utf-18.1 {Tcl_UniCharToTitle, add one for title} { - string totitle \u01c4 -} \u01c5 + string totitle \u01C4 +} \u01C5 test utf-18.2 {Tcl_UniCharToTitle, subtract one for title} { - string totitle \u01c6 -} \u01c5 + string totitle \u01C6 +} \u01C5 test utf-18.3 {Tcl_UniCharToTitle, subtract delta for title (positive)} { - string totitle \u017f -} \u0053 + string totitle \u017F +} \x53 test utf-18.4 {Tcl_UniCharToTitle, subtract delta for title (negative)} { - string totitle \u00ff + string totitle \xFF } \u0178 test utf-18.5 {Tcl_UniCharToTitle, no delta} { string totitle ! @@ -384,15 +387,15 @@ test utf-20.1 {TclUniCharNcmp} { test utf-21.1 {TclUniCharIsAlnum} { # this returns 1 with Unicode 7 compliance - string is alnum \u1040\u021f\u0220 + string is alnum \u1040\u021F\u0220 } {1} test utf-21.2 {unicode alnum char in regc_locale.c} { # this returns 1 with Unicode 7 compliance - list [regexp {^[[:alnum:]]+$} \u1040\u021f\u0220] [regexp {^\w+$} \u1040\u021f\u0220_\u203f\u2040\u2054\ufe33\ufe34\ufe4d\ufe4e\ufe4f\uff3f] + list [regexp {^[[:alnum:]]+$} \u1040\u021F\u0220] [regexp {^\w+$} \u1040\u021F\u0220_\u203F\u2040\u2054\uFE33\uFE34\uFE4D\uFE4E\uFE4F\uFF3F] } {1 1} test utf-21.3 {unicode print char in regc_locale.c} { # this returns 1 with Unicode 7 compliance - regexp {^[[:print:]]+$} \ufbc1 + regexp {^[[:print:]]+$} \uFBC1 } 1 test utf-21.4 {TclUniCharIsGraph} { # [Bug 3464428] @@ -404,65 +407,65 @@ test utf-21.5 {unicode graph char in regc_locale.c} { } {1} test utf-21.6 {TclUniCharIsGraph} { # [Bug 3464428] - string is graph \u00a0 + string is graph \xA0 } {0} test utf-21.7 {unicode graph char in regc_locale.c} { # [Bug 3464428] - regexp {[[:graph:]]} \u0020\u00a0\u2028\u2029 + regexp {[[:graph:]]} \x20\xA0\u2028\u2029 } {0} test utf-21.8 {TclUniCharIsPrint} { # [Bug 3464428] - string is print \u0009 + string is print \x09 } {0} test utf-21.9 {unicode print char in regc_locale.c} { # [Bug 3464428] - regexp {[[:print:]]} \u0009 + regexp {[[:print:]]} \x09 } {0} test utf-21.10 {unicode print char in regc_locale.c} { # [Bug 3464428] - regexp {[[:print:]]} \u0009 + regexp {[[:print:]]} \x09 } {0} test utf-21.11 {TclUniCharIsControl} { # [Bug 3464428] - string is control \u0000\u001f\u00ad\u0605\u061c\u180e\u2066\ufeff + string is control \x00\x1F\xAD\u0605\u061C\u180E\u2066\uFEFF } {1} test utf-21.12 {unicode control char in regc_locale.c} { # [Bug 3464428], [Bug a876646efe] - regexp {^[[:cntrl:]]*$} \u0000\u001f\u00ad\u0605\u061c\u180e\u2066\ufeff + regexp {^[[:cntrl:]]*$} \x00\x1F\xAD\u0605\u061C\u180E\u2066\uFEFF } {1} test utf-22.1 {TclUniCharIsWordChar} { string wordend "xyz123_bar fg" 0 } 10 test utf-22.2 {TclUniCharIsWordChar} { - string wordend "x\u5080z123_bar\u203c fg" 0 + string wordend "x\u5080z123_bar\u203C fg" 0 } 10 test utf-23.1 {TclUniCharIsAlpha} { # this returns 1 with Unicode 7 compliance - string is alpha \u021f\u0220\u037f\u052f + string is alpha \u021F\u0220\u037F\u052F } {1} test utf-23.2 {unicode alpha char in regc_locale.c} { # this returns 1 with Unicode 7 compliance - regexp {^[[:alpha:]]+$} \u021f\u0220\u037f\u052f + regexp {^[[:alpha:]]+$} \u021F\u0220\u037F\u052F } {1} test utf-24.1 {TclUniCharIsDigit} { # this returns 1 with Unicode 7 compliance - string is digit \u1040\uabf0 + string is digit \u1040\uABF0 } {1} test utf-24.2 {unicode digit char in regc_locale.c} { # this returns 1 with Unicode 7 compliance - list [regexp {^[[:digit:]]+$} \u1040\uabf0] [regexp {^\d+$} \u1040\uabf0] + list [regexp {^[[:digit:]]+$} \u1040\uABF0] [regexp {^\d+$} \u1040\uABF0] } {1 1} test utf-24.3 {TclUniCharIsSpace} { # this returns 1 with Unicode 7/TIP 413 compliance - string is space \u0085\u1680\u180e\u200b\u202f\u2060 + string is space \x85\u1680\u180E\u200B\u202F\u2060 } {1} test utf-24.4 {unicode space char in regc_locale.c} { # this returns 1 with Unicode 7/TIP 413 compliance - list [regexp {^[[:space:]]+$} \u0085\u1680\u180e\u200b\u202f\u2060] [regexp {^\s+$} \u0085\u1680\u180e\u200b\u202f\u2060] + list [regexp {^[[:space:]]+$} \x85\u1680\u180E\u200B\u202F\u2060] [regexp {^\s+$} \x85\u1680\u180E\u200B\u202F\u2060] } {1 1} testConstraint teststringobj [llength [info commands teststringobj]] |