diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-27 14:48:37 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-01-27 14:48:37 (GMT) |
commit | 0318ff75d91a0c0ad84a7738939a99c4567ddc3b (patch) | |
tree | e5e9e3a30d9ed232d3903aea689308bbf8648c3c /tests/encoding.test | |
parent | 8ea5f2cfcee413e2281a0434827d999f43743f6c (diff) | |
parent | 06de3a9ba1e4397a226e168a72c9da63c2a6f30a (diff) | |
download | tcl-0318ff75d91a0c0ad84a7738939a99c4567ddc3b.zip tcl-0318ff75d91a0c0ad84a7738939a99c4567ddc3b.tar.gz tcl-0318ff75d91a0c0ad84a7738939a99c4567ddc3b.tar.bz2 |
Fix off-by-one error in tclCmdAH.c, with testcases showing that it works now.
Diffstat (limited to 'tests/encoding.test')
-rw-r--r-- | tests/encoding.test | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/encoding.test b/tests/encoding.test index 90e81dd..10a37f8 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -171,7 +171,7 @@ test encoding-6.2 {Tcl_CreateEncoding: replace encoding} {testencoding} { test encoding-7.1 {Tcl_ExternalToUtfDString: small buffer} { encoding convertfrom jis0208 8c8c8c8c -} "吾吾吾吾" +} 吾吾吾吾 test encoding-7.2 {Tcl_UtfToExternalDString: big buffer} { set a 8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C8C append a $a @@ -193,7 +193,7 @@ test encoding-8.1 {Tcl_ExternalToUtf} { close $f file delete [file join [temporaryDirectory] dummy] return $x -} "ab乎g" +} ab乎g test encoding-9.1 {Tcl_UtfToExternalDString: small buffer} { encoding convertto jis0208 "吾吾吾吾" @@ -213,7 +213,7 @@ test encoding-9.2 {Tcl_UtfToExternalDString: big buffer} { test encoding-10.1 {Tcl_UtfToExternal} { set f [open [file join [temporaryDirectory] dummy] w] fconfigure $f -translation binary -encoding shiftjis - puts -nonewline $f "ab乎g" + puts -nonewline $f ab乎g close $f set f [open [file join [temporaryDirectory] dummy] r] fconfigure $f -translation binary -encoding iso8859-1 @@ -248,7 +248,7 @@ test encoding-11.1 {LoadEncodingFile: unknown encoding} {testencoding} { } {1 {unknown encoding "jis0208"} 8C} test encoding-11.2 {LoadEncodingFile: single-byte} { encoding convertfrom jis0201 \xA1 -} "。" +} 。 test encoding-11.3 {LoadEncodingFile: double-byte} { encoding convertfrom jis0208 8C } 乎 @@ -513,11 +513,24 @@ test encoding-17.10 {Utf32ToUtfProc} -body { encoding convertfrom -nocomplain utf-32 "\xFF\xFF\xFF\xFF" } -result \uFFFD - -test encoding-18.1 {TableToUtfProc error on invalid input with -strict} -body { +test encoding-18.1 {TableToUtfProc on invalid input} -constraints deprecated -body { + list [catch {encoding convertto jis0208 \\} res] $res +} -result {0 !)} +test encoding-18.2 {TableToUtfProc on invalid input with -strict} -body { list [catch {encoding convertto -strict jis0208 \\} res] $res } -result {1 {unexpected character at index 0: 'U+00005C'}} - +test encoding-18.3 {TableToUtfProc on invalid input with -strict -failindex} -body { + list [catch {encoding convertto -strict -failindex pos jis0208 \\} res] $res $pos +} -result {0 {} 0} +test encoding-18.4 {TableToUtfProc on invalid input with -failindex -strict} -body { + list [catch {encoding convertto -failindex pos -strict jis0208 \\} res] $res $pos +} -result {0 {} 0} +test encoding-18.5 {TableToUtfProc on invalid input with -failindex} -body { + list [catch {encoding convertto -failindex pos jis0208 \\} res] $res $pos +} -result {0 {} 0} +test encoding-18.6 {TableToUtfProc on invalid input with -nocomplain} -body { + list [catch {encoding convertto -nocomplain jis0208 \\} res] $res +} -result {0 !)} test encoding-19.1 {TableFromUtfProc} { } {} |