From b1098f9b9ec87b916f660037c3ba461ea426eb55 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 14 Apr 2020 10:55:04 +0000 Subject: Don't use 'identiy' encoding in test-cases any more! --- tests/encoding.test | 26 +++++++++++--------------- tests/string.test | 16 ++++++++-------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/tests/encoding.test b/tests/encoding.test index f6fb29a..ce0467a 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -315,24 +315,20 @@ test encoding-14.1 {BinaryProc} { test encoding-15.1 {UtfToUtfProc} { encoding convertto utf-8 \xa3 } "\xc2\xa3" -test encoding-15.2 {UtfToUtfProc null character output} { - set x \u0000 - set y [encoding convertto utf-8 \u0000] - set y [bytestring $y] - binary scan $y H* z - list [string bytelength $x] [string bytelength $y] $z -} {2 1 00} -test encoding-15.3 {UtfToUtfProc null character input} { - set x [bytestring \x00] - set y [encoding convertfrom utf-8 $x] - binary scan [encoding convertto identity $y] H* z - list [string bytelength $x] [string bytelength $y] $z -} {1 2 c080} -test encoding-15.4 {UtfToUtfProc emoji character input} { +test encoding-15.2 {UtfToUtfProc null character output} testbytestring { + binary scan [testbytestring [encoding convertto utf-8 \u0000]] H* z + set z +} 00 +test encoding-15.3 {UtfToUtfProc null character input} teststringbytes { + set y [encoding convertfrom utf-8 [encoding convertto utf-8 \u0000]] + binary scan [teststringbytes $y] H* z + set z +} c080 +test encoding-15.4 {UtfToUtfProc emoji character input} -body { set x \xED\xA0\xBD\xED\xB8\x82 set y [encoding convertfrom utf-8 \xED\xA0\xBD\xED\xB8\x82] list [string length $x] $y -} "6 \uD83D\uDE02" +} -result "6 \uD83D\uDE02" test encoding-15.5 {UtfToUtfProc emoji character input} { set x \xF0\x9F\x98\x82 set y [encoding convertfrom utf-8 \xF0\x9F\x98\x82] diff --git a/tests/string.test b/tests/string.test index bb4c797..41d1e9f 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1561,11 +1561,11 @@ test string-20.5 {string trimright} { test string-20.6 {string trimright, unicode default} { string trimright ABC\u1361\u0085\x00\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2028\u2029\u202F\u205F\u3000 } ABC\u1361 -test string-20.7 {string trim on not valid utf-8 sequence (consider NTS as continuation char), bug [c61818e4c9]} { +test string-20.7 {string trim on not valid utf-8 sequence (consider NTS as continuation char), bug [c61818e4c9]} testbytestring { set result {} - set a [bytestring \xc0\x80\x88] + set a [testbytestring \xc0\x80\x88] set b foo$a - set m [list \u0000 U \x88 V [bytestring \x88] W] + set m [list \u0000 U \x88 V [testbytestring \x88] W] lappend result [string map $m $b] lappend result [string map $m [string trimright $b x]] lappend result [string map $m [string trimright $b \u0000]] @@ -1574,11 +1574,11 @@ test string-20.7 {string trim on not valid utf-8 sequence (consider NTS as conti lappend result [string map $m [string trim $b fox]] lappend result [string map $m [string trim $b fo\u0000]] } [list {*}[lrepeat 3 fooUV] {*}[lrepeat 2 UV V]] -test string-20.8 {[c61818e4c9] [string trimright] fails when UtfPrev is ok} { +test string-20.8 {[c61818e4c9] [string trimright] fails when UtfPrev is ok} testbytestring { set result {} - set a [bytestring \xE8\x80] + set a [testbytestring \xE8\x80] set b foo$a - set m [list \xE8 U \x80 V [bytestring \xE8] W [bytestring \x80] X]] + set m [list \xE8 U \x80 V [testbytestring \xE8] W [bytestring \x80] X]] lappend result [string map $m $b] lappend result [string map $m [string trimright $b x]] lappend result [string map $m [string trimright $b \xE8]] @@ -1672,9 +1672,9 @@ test string-22.12 {string wordstart, unicode} { test string-22.13 {string wordstart, unicode} { string wordstart "\uC700\uC700 abc" 8 } 3 -test string-22.14 {string wordstart, invalid UTF-8} { +test string-22.14 {string wordstart, invalid UTF-8} testbytestring { # See Bug c61818e4c9 - set demo [bytestring "abc def\xE0\xA9ghi"] + set demo [testbytestring "abc def\xE0\xA9ghi"] string index $demo [string wordstart $demo 10] } g -- cgit v0.12