diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-04-09 06:36:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-04-09 06:36:45 (GMT) |
commit | 7bb103b64e67ebad946e01122755068083296f66 (patch) | |
tree | 7229ceb914f43fc3fb2ac9faf80580342f000f8a | |
parent | ee577ebd90b47d4ab597370cfd5c8e7f4a09cb7b (diff) | |
download | tcl-7bb103b64e67ebad946e01122755068083296f66.zip tcl-7bb103b64e67ebad946e01122755068083296f66.tar.gz tcl-7bb103b64e67ebad946e01122755068083296f66.tar.bz2 |
More test-cases, involving \xC0 \x80
-rw-r--r-- | tests/append.test | 14 | ||||
-rw-r--r-- | tests/string.test | 6 | ||||
-rw-r--r-- | tests/utf.test | 25 |
3 files changed, 37 insertions, 8 deletions
diff --git a/tests/append.test b/tests/append.test index f26925f..057410a 100644 --- a/tests/append.test +++ b/tests/append.test @@ -61,10 +61,22 @@ test append-3.5 {append surrogates} -body { set x \uD83D set x $x\uDE02 } -result \uD83D\uDE02 -test append-3.5 {append surrogates} -body { +test append-3.6 {append surrogates} -body { set x \uDE02 set x \uD83D$x } -result \uD83D\uDE02 +test append-3.7 {append \xC0 \x80} -body { + set x [testbytestring \xC0] + string length [append x [testbytestring \x80]] +} -result 2 +test append-3.8 {append \xC0 \x80} -body { + set x [testbytestring \xC0] + string length $x[testbytestring \x80] +} -result 2 +test append-3.9 {append \xC0 \x80} -body { + set x [testbytestring \x80] + string length [testbytestring \xC0]$x +} -result 2 test append-4.1 {lappend command} { unset -nocomplain x diff --git a/tests/string.test b/tests/string.test index c703490..c2d47d3 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1620,6 +1620,12 @@ test string-14.21.$noComp {string replace (surrogates)} { test string-14.22.$noComp {string replace (surrogates)} { run {string replace ?\uDE02 0 end-1 \uD83D} } \uD83D\uDE02 +test string-14.23.$noComp {string replace \xC0 \x80} testbytestring { + run {string length [string replace [testbytestring \xC0]? 1 end [testbytestring \x80]]} +} 2 +test string-14.24.$noComp {string replace \xC0 \x80} testbytestring { + run {string length [string replace ?[testbytestring \x80] 0 end-1 [testbytestring \xC0]]} +} 2 test stringComp-14.21.$noComp {Bug 82e7f67325} { diff --git a/tests/utf.test b/tests/utf.test index 308f06c..6ae8d18 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -84,14 +84,25 @@ test utf-1.13.0 {Tcl_UniCharToUtf: Invalid surrogate} {Uesc ucs2} { test utf-1.13.1 {Tcl_UniCharToUtf: Invalid surrogate} {fullutf testbytestring} { expr {"\UD842" eq [testbytestring \xEF\xBF\xBD]} } 1 -test utf-1.14 {Tcl_UniCharToUtf: surrogate pairs from concat} {pairsTo4bytes testbytestring} { - set hi \uD83D +test utf-1.14 {Tcl_UniCharToUtf: surrogate pairs from concat} { set lo \uDE02 - expr {"$hi$lo" eq [testbytestring \xF0\x9F\x98\x82]} -} 1 -test utf-1.15 {Tcl_UniCharToUtf: surrogate pairs from concat} {pairsTo4bytes testbytestring} { - expr {[string cat \uD83D \uDE02] eq [testbytestring \xF0\x9F\x98\x82]} -} 1 + return \uD83D$lo +} \uD83D\uDE02 +test utf-1.15 {Tcl_UniCharToUtf: surrogate pairs from concat} { + set hi \uD83D + return $hi\uDE02 +} \uD83D\uDE02 +test utf-1.16 {Tcl_UniCharToUtf: \xC0 + \x80} testbytestring { + set lo [testbytestring \x80] + string length [testbytestring \xC0]$lo +} 2 +test utf-1.17 {Tcl_UniCharToUtf: \xC0 + \x80} testbytestring { + set hi [testbytestring \xC0] + string length $hi[testbytestring \x80] +} 2 +test utf-1.18 {Tcl_UniCharToUtf: surrogate pairs from concat} { + string cat \uD83D \uDE02 +} \uD83D\uDE02 test utf-2.1 {Tcl_UtfToUniChar: low ascii} { string length "abc" |