summaryrefslogtreecommitdiffstats
path: root/tests/utf.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-26 21:11:40 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-26 21:11:40 (GMT)
commite6de958cf55d8685930192267e22e8a842c7575b (patch)
treee49dae88855f9fd97c13e9d32aa3318af75a02a2 /tests/utf.test
parent371c07da346f6b67f915100aa1bb558cf02fe41d (diff)
downloadtcl-e6de958cf55d8685930192267e22e8a842c7575b.zip
tcl-e6de958cf55d8685930192267e22e8a842c7575b.tar.gz
tcl-e6de958cf55d8685930192267e22e8a842c7575b.tar.bz2
Refine the constraint. The fact that Tcl stores extended characters
internally does not imply that [string length] counts UCS4 characters instead of UTF-16 code units.
Diffstat (limited to 'tests/utf.test')
-rw-r--r--tests/utf.test6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/utf.test b/tests/utf.test
index f5e5bcc..a9e5353 100644
--- a/tests/utf.test
+++ b/tests/utf.test
@@ -18,6 +18,8 @@ namespace path ::tcl::mathop
testConstraint ucs2 [expr {[format %c 0x010000] eq "\uFFFD"}]
testConstraint fullutf [expr {[format %c 0x010000] ne "\uFFFD"}]
testConstraint tip389 [expr {[string length [format %c 0x10000]] eq 2}]
+testConstraint ucs4 [expr {[testConstraint fullutf]
+ && [string length [format %c 0x10000]] == 1}]
testConstraint Uesc [eq \U0041 A]
testConstraint pairsTo4bytes [expr {[llength [info commands teststringbytes]]
@@ -100,7 +102,7 @@ test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} testbytestrin
test utf-2.8.0 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs2} {
string length [testbytestring "\xF0\x90\x80\x80"]
} 4
-test utf-2.8.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring fullutf} {
+test utf-2.8.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs4} {
string length [testbytestring "\xF0\x90\x80\x80"]
} 1
test utf-2.8.2 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring tip389} {
@@ -109,7 +111,7 @@ test utf-2.8.2 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytest
test utf-2.9.0 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs2} {
string length [testbytestring "\xF4\x8F\xBF\xBF"]
} 4
-test utf-2.9.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring fullutf} {
+test utf-2.9.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs4} {
string length [testbytestring "\xF4\x8F\xBF\xBF"]
} 1
test utf-2.9.2 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring tip389} {