1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

associate random colours with authors

This commit is contained in:
Jesse Duffield
2021-10-23 18:17:35 +11:00
parent f704707d29
commit 253504a094
5 changed files with 145 additions and 4 deletions

View File

@ -248,3 +248,51 @@ func TestReverse(t *testing.T) {
}
}
}
func TestLimitStr(t *testing.T) {
for _, test := range []struct {
values string
limit int
want string
}{
{
values: "",
limit: 10,
want: "",
},
{
values: "",
limit: 0,
want: "",
},
{
values: "a",
limit: 1,
want: "a",
},
{
values: "ab",
limit: 2,
want: "ab",
},
{
values: "abc",
limit: 3,
want: "abc",
},
{
values: "abcd",
limit: 3,
want: "abc",
},
{
values: "abcde",
limit: 3,
want: "abc",
},
} {
if got := LimitStr(test.values, test.limit); !assert.EqualValues(t, got, test.want) {
t.Errorf("LimitString(%v, %d) = %v; want %v", test.values, test.limit, got, test.want)
}
}
}