From 06c51c6b90d0f09d4b7cebd7a4018e9ca5dacd9f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 30 Apr 2021 13:39:35 +0000 Subject: More test-cases --- tests/encoding.test | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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] # -- cgit v0.12