summaryrefslogtreecommitdiffstats
path: root/tests/encoding.test
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2022-03-14 17:39:22 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2022-03-14 17:39:22 (GMT)
commit938fc2c7a0aef1a5d7655f1e0227d57b6d518f1d (patch)
treedd05463900714c474380125d533b7cb749137d57 /tests/encoding.test
parente1f11871dd6bf0d90bef16897153fd0c00c9d136 (diff)
downloadtcl-938fc2c7a0aef1a5d7655f1e0227d57b6d518f1d.zip
tcl-938fc2c7a0aef1a5d7655f1e0227d57b6d518f1d.tar.gz
tcl-938fc2c7a0aef1a5d7655f1e0227d57b6d518f1d.tar.bz2
TIP607 encoding failindex: some tests and implementation (not working)
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 bf82493..7020077 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]