summaryrefslogtreecommitdiffstats
path: root/tests/encoding.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-03-30 14:04:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-03-30 14:04:40 (GMT)
commit923c7e81f475fdeabbb4276eb3ff6d31dfcf17f2 (patch)
tree5e2b6a1ba08eb5538726ec81b021e4fee09422f5 /tests/encoding.test
parent78a0992b4431f976641f3d08f63c13fab742e1b9 (diff)
parent269722c41046a3adc7c2d5fed46b28063ed714b0 (diff)
downloadtcl-923c7e81f475fdeabbb4276eb3ff6d31dfcf17f2.zip
tcl-923c7e81f475fdeabbb4276eb3ff6d31dfcf17f2.tar.gz
tcl-923c7e81f475fdeabbb4276eb3ff6d31dfcf17f2.tar.bz2
Merge tip-597. More testcases
Diffstat (limited to 'tests/encoding.test')
-rw-r--r--tests/encoding.test101
1 files changed, 88 insertions, 13 deletions
diff --git a/tests/encoding.test b/tests/encoding.test
index 114b296..d6c4784 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -340,61 +340,61 @@ test encoding-15.5 {UtfToUtfProc emoji character input} {
} "4 😂"
test encoding-15.6 {UtfToUtfProc emoji character output} {
set x \uDE02\uD83D\uDE02\uD83D
- set y [encoding convertto utf-8 \uDE02\uD83D\uDE02\uD83D]
+ set y [encoding convertto wtf-8 \uDE02\uD83D\uDE02\uD83D]
binary scan $y H* z
list [string length $y] $z
} {10 edb882f09f9882eda0bd}
test encoding-15.7 {UtfToUtfProc emoji character output} {
set x \uDE02\uD83D\uD83D
- set y [encoding convertto utf-8 \uDE02\uD83D\uD83D]
+ set y [encoding convertto wtf-8 \uDE02\uD83D\uD83D]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {3 9 edb882eda0bdeda0bd}
test encoding-15.8 {UtfToUtfProc emoji character output} {
set x \uDE02\uD83Dé
- set y [encoding convertto utf-8 \uDE02\uD83Dé]
+ set y [encoding convertto wtf-8 \uDE02\uD83Dé]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {3 8 edb882eda0bdc3a9}
test encoding-15.9 {UtfToUtfProc emoji character output} {
set x \uDE02\uD83DX
- set y [encoding convertto utf-8 \uDE02\uD83DX]
+ set y [encoding convertto wtf-8 \uDE02\uD83DX]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {3 7 edb882eda0bd58}
test encoding-15.10 {UtfToUtfProc high surrogate character output} {
set x \uDE02é
- set y [encoding convertto utf-8 \uDE02é]
+ set y [encoding convertto wtf-8 \uDE02é]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {2 5 edb882c3a9}
test encoding-15.11 {UtfToUtfProc low surrogate character output} {
set x \uDA02é
- set y [encoding convertto utf-8 \uDA02é]
+ set y [encoding convertto wtf-8 \uDA02é]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {2 5 eda882c3a9}
test encoding-15.12 {UtfToUtfProc high surrogate character output} {
set x \uDE02Y
- set y [encoding convertto utf-8 \uDE02Y]
+ set y [encoding convertto wtf-8 \uDE02Y]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {2 4 edb88259}
test encoding-15.13 {UtfToUtfProc low surrogate character output} {
set x \uDA02Y
- set y [encoding convertto utf-8 \uDA02Y]
+ set y [encoding convertto wtf-8 \uDA02Y]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {2 4 eda88259}
test encoding-15.14 {UtfToUtfProc high surrogate character output} {
set x \uDE02
- set y [encoding convertto utf-8 \uDE02]
+ set y [encoding convertto wtf-8 \uDE02]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {1 3 edb882}
test encoding-15.15 {UtfToUtfProc low surrogate character output} {
set x \uDA02
- set y [encoding convertto utf-8 \uDA02]
+ set y [encoding convertto wtf-8 \uDA02]
binary scan $y H* z
list [string length $x] [string length $y] $z
} {1 3 eda882}
@@ -409,6 +409,72 @@ test encoding-15.17 {UtfToUtfProc emoji character output} {
binary scan $y H* z
list [string length $y] $z
} {4 f09f9882}
+test encoding-15.18 {UtfToUtfProc emoji character output} {
+ set x \uDE02\uD83D\uDE02\uD83D
+ set y [encoding convertto utf-8 \uDE02\uD83D\uDE02\uD83D]
+ binary scan $y H* z
+ list [string length $y] $z
+} {10 efbfbdf09f9882efbfbd}
+test encoding-15.19 {UtfToUtfProc emoji character output} {
+ set x \uDE02\uD83D\uD83D
+ set y [encoding convertto utf-8 \uDE02\uD83D\uD83D]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {3 9 efbfbdefbfbdefbfbd}
+test encoding-15.20 {UtfToUtfProc emoji character output} {
+ set x \uDE02\uD83D\xE9
+ set y [encoding convertto utf-8 \uDE02\uD83D\xE9]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {3 8 efbfbdefbfbdc3a9}
+test encoding-15.21 {UtfToUtfProc emoji character output} {
+ set x \uDE02\uD83DX
+ set y [encoding convertto utf-8 \uDE02\uD83DX]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {3 7 efbfbdefbfbd58}
+test encoding-15.22 {UtfToUtfProc high surrogate character output} {
+ set x \uDE02\xE9
+ set y [encoding convertto utf-8 \uDE02\xE9]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {2 5 efbfbdc3a9}
+test encoding-15.23 {UtfToUtfProc low surrogate character output} {
+ set x \uDA02\xE9
+ set y [encoding convertto utf-8 \uDA02\xE9]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {2 5 efbfbdc3a9}
+test encoding-15.24 {UtfToUtfProc high surrogate character output} {
+ set x \uDE02Y
+ set y [encoding convertto utf-8 \uDE02Y]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {2 4 efbfbd59}
+test encoding-15.25 {UtfToUtfProc low surrogate character output} {
+ set x \uDA02Y
+ set y [encoding convertto utf-8 \uDA02Y]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {2 4 efbfbd59}
+test encoding-15.26 {UtfToUtfProc high surrogate character output} {
+ set x \uDE02
+ set y [encoding convertto utf-8 \uDE02]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {1 3 efbfbd}
+test encoding-15.27 {UtfToUtfProc low surrogate character output} {
+ set x \uDA02
+ set y [encoding convertto utf-8 \uDA02]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {1 3 efbfbd}
+test encoding-15.28 {UtfToUtfProc CESU-8 6-byte sequence} {
+ set x \U10000
+ set y [encoding convertto cesu-8 \U10000]
+ binary scan $y H* z
+ list [string length $x] [string length $y] $z
+} {2 6 eda080edb080}
test encoding-16.1 {Utf16ToUtfProc} -body {
set val [encoding convertfrom utf-16 NN]
@@ -435,14 +501,20 @@ test encoding-17.1 {UtfToUtf16Proc} -body {
encoding convertto utf-16 "\U460DC"
} -result "\xD8\xD8\xDC\xDC"
test encoding-17.2 {UtfToUtf16Proc} -body {
- encoding convertto utf-16 "\uDCDC"
+ encoding convertto wtf-16 "\uDCDC"
} -result "\xDC\xDC"
test encoding-17.3 {UtfToUtf16Proc} -body {
- encoding convertto utf-16 "\uD8D8"
+ encoding convertto wtf-16 "\uD8D8"
} -result "\xD8\xD8"
test encoding-17.4 {UtfToUcs2Proc} -body {
encoding convertfrom utf-16 [encoding convertto ucs-2 "\U460DC"]
} -result "\uFFFD"
+test encoding-17.5 {UtfToUtf16Proc} -body {
+ encoding convertto utf-16be "\uDCDC"
+} -result "\xFF\xFD"
+test encoding-17.6 {UtfToUtf16Proc} -body {
+ encoding convertto utf-16le "\uD8D8"
+} -result "\xFD\xFF"
test encoding-18.1 {TableToUtfProc} {
} {}
@@ -601,6 +673,9 @@ test encoding-24.17 {Parse valid or invalid utf-8} -constraints testbytestring -
test encoding-24.18 {Parse valid or invalid utf-8} -constraints testbytestring -body {
encoding convertto utf-8 [testbytestring "Z\xE0\x80"] -stoponerror
} -returnCodes 1 -match glob -result {unexpected character at index 1: '*' (U+0000E0)}
+test encoding-24.19 {Parse valid or invalid utf-8} -constraints testbytestring -body {
+ encoding convertto utf-8 "ZX\uD800" -stoponerror
+} -returnCodes 1 -match glob -result "unexpected character at index 2: '\uD800' (U+00D800)"
file delete [file join [temporaryDirectory] iso2022.txt]
@@ -763,7 +838,7 @@ test encoding-28.0 {all encodings load} -body {
llength $name
}
return $count
-} -result [expr {[info exists ::tcl_precision] ? 86 : 85}]
+} -result [expr {[info exists ::tcl_precision] ? 91 : 90}]
runtests