summaryrefslogtreecommitdiffstats
path: root/tests/utfext.test
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2025-05-26 05:12:10 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2025-05-26 05:12:10 (GMT)
commitc4618712a008b8d0377029f7991ee60deba4fb0a (patch)
tree1ec3a2595a89849b856f7672b089930c7bc89b99 /tests/utfext.test
parent5d722018bad4420f72308bd15a9f9617661bc5da (diff)
downloadtcl-c4618712a008b8d0377029f7991ee60deba4fb0a.zip
tcl-c4618712a008b8d0377029f7991ee60deba4fb0a.tar.gz
tcl-c4618712a008b8d0377029f7991ee60deba4fb0a.tar.bz2
Handle tcl8 and replace profiles for truncated escape encodings. Add tests.
Diffstat (limited to 'tests/utfext.test')
-rw-r--r--tests/utfext.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/utfext.test b/tests/utfext.test
index ca74229..8ab4bc4 100644
--- a/tests/utfext.test
+++ b/tests/utfext.test
@@ -320,6 +320,48 @@ namespace eval utftest {
set result [list [testencoding Tcl_ExternalToUtf shiftjis $src {start tcl8} 0 16 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten]
lappend result {*}[list [testencoding Tcl_ExternalToUtf shiftjis [string range $src $srcRead end] {end tcl8} 0 10 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten]
} -result [list [list multibyte 0 \xEF\xBC\x90\xEF\xBC\x91\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF] 4 6 2 [list ok 0 \xC2\x82\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF] 1 2 1] -constraints testencoding
+
+ test Tcl_ExternalToUtf-bug-7346adc50f-strict-0 {
+ truncated input in escape encoding (strict)
+ } -body {
+ set src [binary decode hex 1b2442242a3b6e24]
+ list {*}[testencoding Tcl_ExternalToUtf iso2022-jp $src {start end strict} 0 16 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten
+ } -result [list syntax 2 [binary decode hex e3818ae8a9a600ffffffffffffffffff] 7 6 2]
+
+ test Tcl_ExternalToUtf-bug-7346adc50f-strict-1 {
+ truncated input in escape encoding (strict, partial)
+ } -body {
+ set src [binary decode hex 1b2442242a3b6e24]
+ list {*}[testencoding Tcl_ExternalToUtf iso2022-jp $src {start strict} 0 16 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten
+ } -result [list multibyte 2 [binary decode hex e3818ae8a9a600ffffffffffffffffff] 7 6 2]
+
+ test Tcl_ExternalToUtf-bug-7346adc50f-replace-0 {
+ truncated input in escape encoding (replace)
+ } -body {
+ set src [binary decode hex 1b2442242a3b6e24]
+ list {*}[testencoding Tcl_ExternalToUtf iso2022-jp $src {start end replace} 0 16 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten
+ } -result [list ok 2 [binary decode hex e3818ae8a9a6efbfbd00ffffffffffff] 8 9 3]
+
+ test Tcl_ExternalToUtf-bug-7346adc50f-replace-1 {
+ truncated input in escape encoding (replace, partial)
+ } -body {
+ set src [binary decode hex 1b2442242a3b6e24]
+ list {*}[testencoding Tcl_ExternalToUtf iso2022-jp $src {start replace} 0 16 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten
+ } -result [list multibyte 2 [binary decode hex e3818ae8a9a600ffffffffffffffffff] 7 6 2]
+
+ test Tcl_ExternalToUtf-bug-7346adc50f-tcl8-0 {
+ truncated input in escape encoding (tcl8)
+ } -body {
+ set src [binary decode hex 1b2442242a3b6e24]
+ list {*}[testencoding Tcl_ExternalToUtf iso2022-jp $src {start end tcl8} 0 16 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten
+ } -result [list ok 2 [binary decode hex e3818ae8a9a6efbfbd00ffffffffffff] 8 9 3]
+
+ test Tcl_ExternalToUtf-bug-7346adc50f-tcl8-1 {
+ truncated input in escape encoding (tcl8, partial)
+ } -body {
+ set src [binary decode hex 1b2442242a3b6e24]
+ list {*}[testencoding Tcl_ExternalToUtf iso2022-jp $src {start tcl8} 0 16 srcRead dstWritten charsWritten] $srcRead $dstWritten $charsWritten
+ } -result [list multibyte 2 [binary decode hex e3818ae8a9a600ffffffffffffffffff] 7 6 2]
}
namespace delete utftest