Skip to content

Commit 0a21090

Browse files
committed
Added a test for Truncate that includes emojis.
1 parent 2e820a2 commit 0a21090

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

runewidth_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,15 @@ func TestTruncateNoNeeded(t *testing.T) {
380380
}
381381
}
382382

383+
func TestTruncateEmoji(t *testing.T) {
384+
s := "😂😡"
385+
expected := "😂"
386+
387+
if out := Truncate(s, 2, ""); out != expected {
388+
t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
389+
}
390+
}
391+
383392
var isneutralwidthtests = []struct {
384393
in rune
385394
out bool

0 commit comments

Comments
 (0)