summaryrefslogtreecommitdiffstats
path: root/tests/encoding.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-04-30 13:39:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-04-30 13:39:35 (GMT)
commit06c51c6b90d0f09d4b7cebd7a4018e9ca5dacd9f (patch)
tree3daf4310089dfc966ccb601756d6dde6d1989ae1 /tests/encoding.test
parent69a846b36ec6a1abf389691e4e9b476dc37992df (diff)
downloadtcl-06c51c6b90d0f09d4b7cebd7a4018e9ca5dacd9f.zip
tcl-06c51c6b90d0f09d4b7cebd7a4018e9ca5dacd9f.tar.gz
tcl-06c51c6b90d0f09d4b7cebd7a4018e9ca5dacd9f.tar.bz2
More test-cases
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 195fc25..5471e0b 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -600,7 +600,33 @@ test encoding-24.10 {Parse valid or invalid utf-8} {
test encoding-24.11 {Parse valid or invalid utf-8} {
string length [encoding convertfrom utf-8 "\xEF\xBF\xBF" -nothrow]
} 1
-
+test encoding-24.12 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xC0\x80" -stoponerror]
+} 1
+test encoding-24.13 {Parse valid or invalid utf-8} -body {
+ encoding convertfrom utf-8 "\xC0\x81" -stoponerror
+} -returnCodes 1 -result {unexpected byte at index 0: 'À' (\xC0)}
+test encoding-24.14 {Parse valid or invalid utf-8} -body {
+ encoding convertfrom utf-8 "\xC1\xBF" -stoponerror
+} -returnCodes 1 -result {unexpected byte at index 0: 'Á' (\xC1)}
+test encoding-24.15 {Parse valid or invalid utf-8} {
+ string length [encoding convertfrom utf-8 "\xC2\x80" -stoponerror]
+} 1
+test encoding-24.16 {Parse valid or invalid utf-8} -body {
+ encoding convertfrom utf-8 "Z\xE0\x80" -stoponerror
+} -returnCodes 1 -result {unexpected byte at index 1: 'à' (\xE0)}
+test encoding-24.17 {Parse valid or invalid utf-8} -constraints testbytestring -body {
+ encoding convertto utf-8 [testbytestring "Z\u4343\x80"] -stoponerror
+} -returnCodes 1 -result {expected byte sequence but character 1 was '䍃€' (U+004343)}
+test encoding-24.18 {Parse valid or invalid utf-8} -constraints testbytestring -body {
+ encoding convertto utf-8 [testbytestring "Z\xE0\x80"] -stoponerror
+} -result "Z\xC3\xA0\xE2\x82\xAC"
+test encoding-24.19 {Parse valid or invalid utf-8} -constraints testbytestring -body {
+ encoding convertto utf-8 [testbytestring "Z\xE0\x80xxxxxx"] -stoponerror
+} -result "Z\xC3\xA0\xE2\x82\xACxxxxxx"
+test encoding-24.20 {Parse valid or invalid utf-8} -constraints testbytestring -body {
+ encoding convertto utf-8 "ZX\uD800" -stoponerror
+} -returnCodes 1 -match glob -result "unexpected character at index 2: '\uD800' (U+00D800)"
file delete [file join [temporaryDirectory] iso2022.txt]
#