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

only use a single initial for double sized runes

This commit is contained in:
Jesse Duffield
2021-10-24 15:54:20 +11:00
parent 6171690b00
commit e122f421e6
2 changed files with 21 additions and 11 deletions

View File

@ -3,15 +3,18 @@ package presentation
import "testing"
func TestGetInitials(t *testing.T) {
for input, output := range map[string]string{
for input, expectedOutput := range map[string]string{
"Jesse Duffield": "JD",
"Jesse Duffield Man": "JD",
"JesseDuffield": "Je",
"J": "J",
"六书六書": "六",
"書": "書",
"": "",
} {
if output != getInitials(input) {
t.Errorf("Expected %s to be %s", input, output)
output := getInitials(input)
if output != expectedOutput {
t.Errorf("Expected %s to be %s", output, expectedOutput)
}
}
}