summaryrefslogtreecommitdiffstats
path: root/tests/encoding.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-05-26 14:10:30 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-05-26 14:10:30 (GMT)
commit20fcf335945daf5dedf6f10f940026b681dd7f1b (patch)
treec8bf2d97a437db781daf72038af86b60b2d4dff8 /tests/encoding.test
parent588e5a48cb262a4fa3d60698be3f1d94434dfcf1 (diff)
downloadtcl-20fcf335945daf5dedf6f10f940026b681dd7f1b.zip
tcl-20fcf335945daf5dedf6f10f940026b681dd7f1b.tar.gz
tcl-20fcf335945daf5dedf6f10f940026b681dd7f1b.tar.bz2
More testcases regarding possible parse errors
Diffstat (limited to 'tests/encoding.test')
-rw-r--r--tests/encoding.test15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/encoding.test b/tests/encoding.test
index 55ace7f..bdebad9 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -624,7 +624,7 @@ test encoding-24.18 {Parse valid or invalid utf-8} -constraints testbytestring -
test encoding-24.19 {Parse valid or invalid utf-8} -constraints testbytestring -body {
encoding convertto -stoponerror utf-8 [testbytestring "Z\xE0\x80xxxxxx"]
} -result "Z\xC3\xA0\xE2\x82\xACxxxxxx"
-test encoding-24.20 {Parse valid or invalid utf-8} -constraints testbytestring -body {
+test encoding-24.20 {Parse valid or invalid utf-8} -body {
encoding convertto -stoponerror utf-8 "ZX\uD800"
} -returnCodes 1 -match glob -result "unexpected character at index 2: 'U+00D800'"
test encoding-24.21 {Parse with -nothrow but without providing encoding} {
@@ -633,6 +633,19 @@ test encoding-24.21 {Parse with -nothrow but without providing encoding} {
test encoding-24.22 {Parse with -nothrow but without providing encoding} {
string length [encoding convertto -nothrow "\x20"]
} 1
+test encoding-24.23 {Syntax error, two encodings} -body {
+ encoding convertfrom iso8859-1 utf-8 "ZX\uD800"
+} -returnCodes 1 -result {wrong # args: should be "::tcl::encoding::convertfrom ?-nothrow|-stoponerror? ?encoding? data"}
+test encoding-24.24 {Syntax error, two encodings} -body {
+ encoding convertto iso8859-1 utf-8 "ZX\uD800"
+} -returnCodes 1 -result {wrong # args: should be "::tcl::encoding::convertto ?-nothrow|-stoponerror? ?encoding? data"}
+test encoding-24.25 {Syntax error, two options} -body {
+ encoding convertfrom -nothrow -stoponerror "ZX\uD800"
+} -returnCodes 1 -result {unknown encoding "-stoponerror"}
+test encoding-24.26 {Syntax error, two options} -body {
+ encoding convertto -nothrow -stoponerror "ZX\uD800"
+} -returnCodes 1 -result {unknown encoding "-stoponerror"}
+
file delete [file join [temporaryDirectory] iso2022.txt]
#