summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-20 23:00:30 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-20 23:00:30 (GMT)
commit4c9bc32c393e100ae9caf7f06e57c798f96ada6d (patch)
tree78910580ab5dc8106f9e53c6d56bd0a78462507f /tests
parent58cf4db1ccb0602f9bd023ecc4e56830aea2453a (diff)
downloadtcl-4c9bc32c393e100ae9caf7f06e57c798f96ada6d.zip
tcl-4c9bc32c393e100ae9caf7f06e57c798f96ada6d.tar.gz
tcl-4c9bc32c393e100ae9caf7f06e57c798f96ada6d.tar.bz2
Pair every compat85 test with a fullutf test so that we cover all variants.
Diffstat (limited to 'tests')
-rw-r--r--tests/utf.test137
1 files changed, 107 insertions, 30 deletions
diff --git a/tests/utf.test b/tests/utf.test
index 1ca3647..1c79f32 100644
--- a/tests/utf.test
+++ b/tests/utf.test
@@ -13,7 +13,9 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
namespace import -force ::tcltest::*
}
-testConstraint compat85 [expr {[format %c 0x010000] == "\uFFFD"}]
+testConstraint compat85 [expr {[format %c 0x010000] eq "\uFFFD"}]
+testConstraint fullutf [expr {[format %c 0x010000] ne "\uFFFD"}]
+
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testfindfirst [llength [info commands testfindfirst]]
testConstraint testfindlast [llength [info commands testfindlast]]
@@ -64,12 +66,18 @@ test utf-2.6 {Tcl_UtfToUniChar: lead (3-byte) followed by 1 trail} testbytestrin
test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} testbytestring {
string length [testbytestring "\xE4\xB9\x8E"]
} {1}
-test utf-2.8 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {testbytestring compat85} -body {
+test utf-2.8.0 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {testbytestring compat85} -body {
string length [testbytestring "\xF0\x90\x80\x80"]
} -result {4}
-test utf-2.9 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {testbytestring compat85} -body {
+test utf-2.8.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {testbytestring fullutf} -body {
+ string length [testbytestring "\xF0\x90\x80\x80"]
+} -result {1}
+test utf-2.9.0 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {testbytestring compat85} -body {
string length [testbytestring "\xF4\x8F\xBF\xBF"]
} -result {4}
+test utf-2.9.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {testbytestring fullutf} -body {
+ string length [testbytestring "\xF4\x8F\xBF\xBF"]
+} -result {1}
test utf-2.10 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, underflow} testbytestring {
string length [testbytestring "\xF0\x8F\xBF\xBF"]
} {4}
@@ -118,9 +126,12 @@ test utf-4.10 {Tcl_NumUtfChars: #u0000, calc len, overcomplete} {testnumutfchars
test utf-4.11 {Tcl_NumUtfChars: 3 bytes of 4-byte UTF-8 characater} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring \xF0\x9F\x92\xA9] 3
} {3}
-test utf-4.12 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring compat85} {
+test utf-4.12.0 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring compat85} {
testnumutfchars [testbytestring \xF0\x9F\x92\xA9] 4
} {4}
+test utf-4.12.1 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring fullutf} {
+ testnumutfchars [testbytestring \xF0\x9F\x92\xA9] 4
+} {1}
test utf-5.1 {Tcl_UtfFindFirst} {testfindfirst testbytestring} {
testfindfirst [testbytestring "abcbc"] 98
@@ -335,9 +346,12 @@ test utf-6.67 {Tcl_UtfNext} testutfnext {
test utf-6.68 {Tcl_UtfNext} testutfnext {
testutfnext \xF2\xA0\xA0G
} 1
-test utf-6.69 {Tcl_UtfNext} {testutfnext compat85} {
+test utf-6.69.0 {Tcl_UtfNext} {testutfnext compat85} {
testutfnext \xF2\xA0\xA0\xA0
} 1
+test utf-6.69.1 {Tcl_UtfNext} {testutfnext fullutf} {
+ testutfnext \xF2\xA0\xA0\xA0
+} 4
test utf-6.70 {Tcl_UtfNext} testutfnext {
testutfnext \xF2\xA0\xA0\xD0
} 1
@@ -350,24 +364,42 @@ test utf-6.71 {Tcl_UtfNext} testutfnext {
test utf-6.73 {Tcl_UtfNext} testutfnext {
testutfnext \xF2\xA0\xA0\xF8
} 1
-test utf-6.74 {Tcl_UtfNext} {testutfnext compat85} {
+test utf-6.74.0 {Tcl_UtfNext} {testutfnext compat85} {
testutfnext \xF2\xA0\xA0\xA0G
} 1
-test utf-6.75 {Tcl_UtfNext} {testutfnext compat85} {
+test utf-6.74.1 {Tcl_UtfNext} {testutfnext fullutf} {
+ testutfnext \xF2\xA0\xA0\xA0G
+} 4
+test utf-6.75.0 {Tcl_UtfNext} {testutfnext compat85} {
testutfnext \xF2\xA0\xA0\xA0\xA0
} 1
-test utf-6.76 {Tcl_UtfNext} {testutfnext compat85} {
+test utf-6.75.1 {Tcl_UtfNext} {testutfnext fullutf} {
+ testutfnext \xF2\xA0\xA0\xA0\xA0
+} 4
+test utf-6.76.0 {Tcl_UtfNext} {testutfnext compat85} {
testutfnext \xF2\xA0\xA0\xA0\xD0
} 1
-test utf-6.77 {Tcl_UtfNext} {testutfnext compat85} {
+test utf-6.76.1 {Tcl_UtfNext} {testutfnext fullutf} {
+ testutfnext \xF2\xA0\xA0\xA0\xD0
+} 4
+test utf-6.77.0 {Tcl_UtfNext} {testutfnext compat85} {
testutfnext \xF2\xA0\xA0\xA0\xE8
} 1
-test utf-6.78 {Tcl_UtfNext} {testutfnext compat85} {
+test utf-6.77.1 {Tcl_UtfNext} {testutfnext fullutf} {
+ testutfnext \xF2\xA0\xA0\xA0\xE8
+} 4
+test utf-6.78.0 {Tcl_UtfNext} {testutfnext compat85} {
testutfnext \xF2\xA0\xA0\xA0\xF2
} 1
-test utf-6.79 {Tcl_UtfNext} {testutfnext compat85} {
+test utf-6.78.1 {Tcl_UtfNext} {testutfnext fullutf} {
+ testutfnext \xF2\xA0\xA0\xA0\xF2
+} 4
+test utf-6.79.0 {Tcl_UtfNext} {testutfnext compat85} {
testutfnext \xF2\xA0\xA0\xA0G\xF8
} 1
+test utf-6.79.1 {Tcl_UtfNext} {testutfnext fullutf} {
+ testutfnext \xF2\xA0\xA0\xA0G\xF8
+} 4
test utf-6.80 {Tcl_UtfNext - overlong sequences} testutfnext {
testutfnext \xC0\x80
} 2
@@ -389,9 +421,12 @@ test utf-6.85 {Tcl_UtfNext - overlong sequences} testutfnext {
test utf-6.86 {Tcl_UtfNext - overlong sequences} testutfnext {
testutfnext \xF0\x80\x80\x80
} 1
-test utf-6.87 {Tcl_UtfNext - overlong sequences} {testutfnext compat85} {
+test utf-6.87.0 {Tcl_UtfNext - overlong sequences} {testutfnext compat85} {
testutfnext \xF0\x90\x80\x80
} 1
+test utf-6.87.1 {Tcl_UtfNext - overlong sequences} {testutfnext fullutf} {
+ testutfnext \xF0\x90\x80\x80
+} 4
test utf-6.88 {Tcl_UtfNext, pointing to 2th byte of 3-byte valid sequence} {testutfnext} {
testutfnext \xA0\xA0
} 1
@@ -404,9 +439,12 @@ test utf-6.89 {Tcl_UtfNext, pointing to 2th byte of 3-byte invalid sequence} {te
test utf-6.89.1 {Tcl_UtfNext, pointing to 2th byte of 3-byte invalid sequence} {testutfnext} {
testutfnext \xF0\x80\x80 1
} 2
-test utf-6.90 {Tcl_UtfNext, validity check [493dccc2de]} {testutfnext compat85} {
+test utf-6.90.0 {Tcl_UtfNext, validity check [493dccc2de]} {testutfnext compat85} {
testutfnext \xF4\x8F\xBF\xBF
} 1
+test utf-6.90.1 {Tcl_UtfNext, validity check [493dccc2de]} {testutfnext fullutf} {
+ testutfnext \xF4\x8F\xBF\xBF
+} 4
test utf-6.91 {Tcl_UtfNext, validity check [493dccc2de]} testutfnext {
testutfnext \xF4\x90\x80\x80
} 1
@@ -474,15 +512,24 @@ test utf-7.9.1 {Tcl_UtfPrev} testutfprev {
test utf-7.9.2 {Tcl_UtfPrev} testutfprev {
testutfprev A\xF8\xA0\xF8\xA0 3
} 2
-test utf-7.10 {Tcl_UtfPrev} {testutfprev compat85} {
+test utf-7.10.0 {Tcl_UtfPrev} {testutfprev compat85} {
testutfprev A\xF2\xA0
} 2
-test utf-7.10.1 {Tcl_UtfPrev} {testutfprev compat85} {
+test utf-7.10.1 {Tcl_UtfPrev} {testutfprev fullutf} {
+ testutfprev A\xF2\xA0
+} 1
+test utf-7.10.1.0 {Tcl_UtfPrev} {testutfprev compat85} {
testutfprev A\xF2\xA0\xA0\xA0 3
} 2
-test utf-7.10.2 {Tcl_UtfPrev} {testutfprev compat85} {
+test utf-7.10.1.1 {Tcl_UtfPrev} {testutfprev fullutf} {
+ testutfprev A\xF2\xA0\xA0\xA0 3
+} 1
+test utf-7.10.2.0 {Tcl_UtfPrev} {testutfprev compat85} {
testutfprev A\xF2\xA0\xF8\xA0 3
} 2
+test utf-7.10.2.1 {Tcl_UtfPrev} {testutfprev fullutf} {
+ testutfprev A\xF2\xA0\xF8\xA0 3
+} 1
test utf-7.11 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8\xA0
} 1
@@ -522,15 +569,24 @@ test utf-7.14.1 {Tcl_UtfPrev} testutfprev {
test utf-7.14.2 {Tcl_UtfPrev} testutfprev {
testutfprev A\xF8\xA0\xA0\xF8 4
} 3
-test utf-7.15 {Tcl_UtfPrev} {testutfprev compat85} {
+test utf-7.15.0 {Tcl_UtfPrev} {testutfprev compat85} {
testutfprev A\xF2\xA0\xA0
} 3
-test utf-7.15.1 {Tcl_UtfPrev} {testutfprev compat85} {
+test utf-7.15.1 {Tcl_UtfPrev} {testutfprev fullutf} {
+ testutfprev A\xF2\xA0\xA0
+} 1
+test utf-7.15.1.0 {Tcl_UtfPrev} {testutfprev compat85} {
testutfprev A\xF2\xA0\xA0\xA0 4
} 3
-test utf-7.15.2 {Tcl_UtfPrev} {testutfprev compat85} {
+test utf-7.15.1.1 {Tcl_UtfPrev} {testutfprev fullutf} {
+ testutfprev A\xF2\xA0\xA0\xA0 4
+} 1
+test utf-7.15.2.0 {Tcl_UtfPrev} {testutfprev compat85} {
testutfprev A\xF2\xA0\xA0\xF8 4
} 3
+test utf-7.15.2.1 {Tcl_UtfPrev} {testutfprev fullutf} {
+ testutfprev A\xF2\xA0\xA0\xF8 4
+} 1
test utf-7.16 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8\xA0\xA0
} 1
@@ -561,9 +617,12 @@ test utf-7.18.2 {Tcl_UtfPrev} testutfprev {
test utf-7.19 {Tcl_UtfPrev} testutfprev {
testutfprev A\xF8\xA0\xA0\xA0
} 4
-test utf-7.20 {Tcl_UtfPrev} {testutfprev compat85} {
+test utf-7.20.0 {Tcl_UtfPrev} {testutfprev compat85} {
testutfprev A\xF2\xA0\xA0\xA0
} 4
+test utf-7.20.1 {Tcl_UtfPrev} {testutfprev fullutf} {
+ testutfprev A\xF2\xA0\xA0\xA0
+} 1
test utf-7.21 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8\xA0\xA0\xA0
} 4
@@ -624,15 +683,24 @@ test utf-7.37 {Tcl_UtfPrev -- overlong sequence} testutfprev {
test utf-7.38 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xE0\xA0\x80 2
} 1
-test utf-7.39 {Tcl_UtfPrev -- overlong sequence} {testutfprev compat85} {
+test utf-7.39.0 {Tcl_UtfPrev -- overlong sequence} {testutfprev compat85} {
testutfprev A\xF0\x90\x80\x80
} 4
-test utf-7.40 {Tcl_UtfPrev -- overlong sequence} {testutfprev compat85} {
+test utf-7.39.1 {Tcl_UtfPrev -- overlong sequence} {testutfprev fullutf} {
+ testutfprev A\xF0\x90\x80\x80
+} 1
+test utf-7.40.0 {Tcl_UtfPrev -- overlong sequence} {testutfprev compat85} {
testutfprev A\xF0\x90\x80\x80 4
} 3
-test utf-7.41 {Tcl_UtfPrev -- overlong sequence} {testutfprev compat85} {
+test utf-7.40.1 {Tcl_UtfPrev -- overlong sequence} {testutfprev fullutf} {
+ testutfprev A\xF0\x90\x80\x80 4
+} 1
+test utf-7.41.0 {Tcl_UtfPrev -- overlong sequence} {testutfprev compat85} {
testutfprev A\xF0\x90\x80\x80 3
} 2
+test utf-7.41.1 {Tcl_UtfPrev -- overlong sequence} {testutfprev fullutf} {
+ testutfprev A\xF0\x90\x80\x80 3
+} 1
test utf-7.42 {Tcl_UtfPrev -- overlong sequence} testutfprev {
testutfprev A\xF0\x90\x80\x80 2
} 1
@@ -657,15 +725,24 @@ test utf-7.47.1 {Tcl_UtfPrev, pointing to 3th byte of 3-byte valid sequence} {te
test utf-7.47.2 {Tcl_UtfPrev, pointing to 3th byte of 3-byte invalid sequence} {testutfprev} {
testutfprev \xE8\xA0\x00 2
} 0
-test utf-7.48 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev compat85} {
+test utf-7.48.0 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev compat85} {
testutfprev A\xF4\x8F\xBF\xBF
} 4
-test utf-7.48.1 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev compat85} {
+test utf-7.48.1 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev fullutf} {
+ testutfprev A\xF4\x8F\xBF\xBF
+} 1
+test utf-7.48.1.0 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev compat85} {
testutfprev A\xF4\x8F\xBF\xBF 4
} 3
-test utf-7.48.2 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev compat85} {
+test utf-7.48.1.1 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev fullutf} {
+ testutfprev A\xF4\x8F\xBF\xBF 4
+} 1
+test utf-7.48.2.0 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev compat85} {
testutfprev A\xF4\x8F\xBF\xBF 3
} 2
+test utf-7.48.2.1 {Tcl_UtfPrev, validity check [493dccc2de]} {testutfprev fullutf} {
+ testutfprev A\xF4\x8F\xBF\xBF 3
+} 1
test utf-7.48.3 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
testutfprev A\xF4\x8F\xBF\xBF 2
} 1
@@ -700,10 +777,10 @@ test utf-8.5 {Tcl_UniCharAtIndex: high surrogate} {
test utf-8.6 {Tcl_UniCharAtIndex: low surrogate} {
string index \uDC42 0
} "\uDC42"
-test utf-8.7 {Tcl_UniCharAtIndex: Emoji} compat85 {
+test utf-8.7 {Tcl_UniCharAtIndex: Emoji} {
string index \uD83D\uDE00 0
} "\uD83D"
-test utf-8.8 {Tcl_UniCharAtIndex: Emoji} compat85 {
+test utf-8.8 {Tcl_UniCharAtIndex: Emoji} {
string index \uD83D\uDE00 1
} "\uDE00"
@@ -713,10 +790,10 @@ test utf-9.1 {Tcl_UtfAtIndex: index = 0} {
test utf-9.2 {Tcl_UtfAtIndex: index > 0} {
string range \u4E4E\u25A\xFF\u543klmnop 1 5
} "\u25A\xFF\u543kl"
-test utf-9.3 {Tcl_UtfAtIndex: index = 0, Emoji} compat85 {
+test utf-9.3 {Tcl_UtfAtIndex: index = 0, Emoji} {
string range \uD83D\uDE00G 0 0
} "\uD83D"
-test utf-9.4 {Tcl_UtfAtIndex: index > 0, Emoji} compat85 {
+test utf-9.4 {Tcl_UtfAtIndex: index > 0, Emoji} {
string range \uD83D\uDE00G 1 1
} "\uDE00"