From 0dcddf9cf0a8fb91de33ffbe12b4ee5389953f8c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 7 Apr 2021 12:30:33 +0000 Subject: More test-cases showing the bug --- tests/append.test | 12 ++++++++++++ tests/format.test | 6 ++++++ tests/string.test | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/tests/append.test b/tests/append.test index a174615..f26925f 100644 --- a/tests/append.test +++ b/tests/append.test @@ -53,6 +53,18 @@ test append-3.3 {append errors} -returnCodes error -body { unset -nocomplain x append x } -result {can't read "x": no such variable} +test append-3.4 {append surrogates} -body { + set x \uD83D + append x \uDE02 +} -result \uD83D\uDE02 +test append-3.5 {append surrogates} -body { + set x \uD83D + set x $x\uDE02 +} -result \uD83D\uDE02 +test append-3.5 {append surrogates} -body { + set x \uDE02 + set x \uD83D$x +} -result \uD83D\uDE02 test append-4.1 {lappend command} { unset -nocomplain x diff --git a/tests/format.test b/tests/format.test index c7a8a10..41918b2 100644 --- a/tests/format.test +++ b/tests/format.test @@ -143,6 +143,12 @@ test format-2.16 {string formatting, width and precision} { test format-2.17 {string formatting, width and precision} { format "a%5.7sa" foobarbaz } "afoobarba" +test format-2.18 {string formatting, surrogates} { + format "\uD83D%s" \uDE02 +} \uD83D\uDE02 +test format-2.19 {string formatting, surrogates} { + format "%s\uDE02" \uD83D +} \uD83D\uDE02 test format-3.1 {Tcl_FormatObjCmd: character formatting} { format "|%c|%0c|%-1c|%1c|%-6c|%6c|%*c|%*c|" 65 65 65 65 65 65 3 65 -4 65 diff --git a/tests/string.test b/tests/string.test index b55a497..c703490 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1614,6 +1614,12 @@ test string-14.20.$noComp {string replace} { run {string replace [makeByteArray abcdefghijklmnop] end-10 end-2\ [makeByteArray NEW]} } {abcdeNEWop} +test string-14.21.$noComp {string replace (surrogates)} { + run {string replace \uD83D? 1 end \uDE02} +} \uD83D\uDE02 +test string-14.22.$noComp {string replace (surrogates)} { + run {string replace ?\uDE02 0 end-1 \uD83D} +} \uD83D\uDE02 test stringComp-14.21.$noComp {Bug 82e7f67325} { -- cgit v0.12