1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-07 22:02:56 +03:00

Add test demonstrating wrong truncation of branch names containing non-ASCII characters

This commit is contained in:
Stefan Haller
2024-06-22 15:25:43 +02:00
parent 93af0016f7
commit 7ec784e2a0

View File

@@ -43,6 +43,16 @@ func Test_getBranchDisplayStrings(t *testing.T) {
showDivergenceCfg: "none", showDivergenceCfg: "none",
expected: []string{"1m", "branch_name"}, 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"}, branch: &models.Branch{Name: "branch_name", Recency: "1m"},
itemOperation: types.ItemOperationNone, itemOperation: types.ItemOperationNone,
@@ -184,6 +194,16 @@ func Test_getBranchDisplayStrings(t *testing.T) {
showDivergenceCfg: "none", showDivergenceCfg: "none",
expected: []string{"1m", "branch_na…"}, 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"}, branch: &models.Branch{Name: "branch_name", Recency: "1m"},
itemOperation: types.ItemOperationNone, itemOperation: types.ItemOperationNone,