summaryrefslogtreecommitdiffstats
path: root/tests/encoding.test
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2022-03-14 18:27:24 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2022-03-14 18:27:24 (GMT)
commitfb7be1b475dce7bf5ba087fedbe93f83e2cb4f06 (patch)
tree297a5c4881a8f291cd517b873d02162419503d27 /tests/encoding.test
parent7413bedc26c18cd1fe17a26376f7cfb84ecd435a (diff)
parent938fc2c7a0aef1a5d7655f1e0227d57b6d518f1d (diff)
downloadtcl-fb7be1b475dce7bf5ba087fedbe93f83e2cb4f06.zip
tcl-fb7be1b475dce7bf5ba087fedbe93f83e2cb4f06.tar.gz
tcl-fb7be1b475dce7bf5ba087fedbe93f83e2cb4f06.tar.bz2
TIP607 encoding failindex: get work out of 8.7 branch to this 9.0 branch. TIP is rebased.
Diffstat (limited to 'tests/encoding.test')
-rw-r--r--tests/encoding.test28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/encoding.test b/tests/encoding.test
index daf91fa..7a1e4e7 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -669,10 +669,36 @@ test encoding-24.21 {Parse with -nocomplain but without providing encoding} {
} 1
test encoding-24.22 {Syntax error, two encodings} -body {
encoding convertfrom iso8859-1 utf-8 "ZX\uD800"
-} -returnCodes 1 -result {wrong # args: should be "::tcl::encoding::convertfrom ?-nocomplain? ?encoding? data"}
+} -returnCodes 1 -result {wrong # args: should be "::tcl::encoding::convertfrom ?-nocomplain|-failindex var? ?encoding? data"}
test encoding-24.23 {Syntax error, two encodings} -body {
encoding convertto iso8859-1 utf-8 "ZX\uD800"
} -returnCodes 1 -result {wrong # args: should be "::tcl::encoding::convertto ?-nocomplain? ?encoding? data"}
+test encoding-24.24 {Syntax error, no parameter} -body {
+ encoding convertfrom
+} -returnCodes 1 -result {wrong # args: should be "encoding convertfrom ?-nocomplain|-failindex var? ?encoding? data"}
+test encoding-24.25 {Syntax error, -nocomplain and -failindex, no encoding} -body {
+ encoding convertfrom -nocomplain -failindex 2 ABC
+} -returnCodes 1 -result {wrong # args: should be "encoding convertfrom ?-nocomplain|-failindex var? ?encoding? data"}
+test encoding-24.26 {Syntax error, -failindex and -nocomplain, no encoding} -body {
+ encoding convertfrom -failindex 2 -nocomplain ABC
+} -returnCodes 1 -result {unknown encoding "-nocomplain"}
+test encoding-24.27 {Syntax error, -nocomplain and -failindex, encoding} -body {
+ encoding convertfrom -nocomplain -failindex 2 utf-8 ABC
+} -returnCodes 1 -result {wrong # args: should be "encoding convertfrom ?-nocomplain|-failindex var? ?encoding? data"}
+test encoding-24.28 {Syntax error, -failindex and -nocomplain, encoding} -body {
+ encoding convertfrom -failindex 2 -nocomplain utf-8 ABC
+} -returnCodes 1 -result {wrong # args: should be "encoding convertfrom ?-nocomplain|-failindex var? ?encoding? data"}
+test encoding-24.29 {Syntax error, -failindex with no var, no encoding} -body {
+ encoding convertfrom -failindex ABC
+} -returnCodes 1 -result {wrong # args: should be "::tcl::encoding::convertfrom ?-nocomplain|-failindex var? ?encoding? data"}
+test encoding-24.30 {convertrom -failindex with correct data} -body {
+ encoding convertfrom -failindex test ABC
+ set test
+} -returnCodes 0 -result -1
+test encoding-24.31 {convertrom -failindex with incomplete utf8} -body {
+ set res [encoding convertfrom -failindex test A\xc3]
+ lappend res $test
+} -returnCodes 0 -result {A 1}
file delete [file join [temporaryDirectory] iso2022.txt]