From 7ec784e2a053b23809cabcad2750db6f2cac1698 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 22 Jun 2024 15:25:43 +0200 Subject: Add test demonstrating wrong truncation of branch names containing non-ASCII characters --- pkg/gui/presentation/branches_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'pkg') diff --git a/pkg/gui/presentation/branches_test.go b/pkg/gui/presentation/branches_test.go index ba79f16ce..14012cda2 100644 --- a/pkg/gui/presentation/branches_test.go +++ b/pkg/gui/presentation/branches_test.go @@ -43,6 +43,16 @@ func Test_getBranchDisplayStrings(t *testing.T) { showDivergenceCfg: "none", expected: []string{"1m", "branch_name"}, }, + { + branch: &models.Branch{Name: "πŸ‰_special_char", Recency: "1m"}, + itemOperation: types.ItemOperationNone, + fullDescription: false, + viewWidth: 19, + useIcons: false, + checkedOutByWorktree: false, + showDivergenceCfg: "none", + expected: []string{"1m", "πŸ‰_special_c…"}, // truncated, but shouldn't + }, { branch: &models.Branch{Name: "branch_name", Recency: "1m"}, itemOperation: types.ItemOperationNone, @@ -184,6 +194,16 @@ func Test_getBranchDisplayStrings(t *testing.T) { showDivergenceCfg: "none", expected: []string{"1m", "branch_na…"}, }, + { + branch: &models.Branch{Name: "πŸ‰_special_char", Recency: "1m"}, + itemOperation: types.ItemOperationNone, + fullDescription: false, + viewWidth: 18, + useIcons: false, + checkedOutByWorktree: false, + showDivergenceCfg: "none", + expected: []string{"1m", "πŸ‰_special_…"}, // truncated two runes too much + }, { branch: &models.Branch{Name: "branch_name", Recency: "1m"}, itemOperation: types.ItemOperationNone, -- cgit v1.2.3