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

refactor to only have one context per view

This commit is contained in:
Jesse Duffield
2022-06-13 11:01:26 +10:00
parent 6dfef08efc
commit 524bf83a4a
372 changed files with 28866 additions and 6902 deletions

View File

@@ -87,3 +87,45 @@ func TestSafeTruncate(t *testing.T) {
assert.EqualValues(t, s.expected, SafeTruncate(s.str, s.limit))
}
}
func TestModuloWithWrap(t *testing.T) {
type scenario struct {
n int
max int
expected int
}
scenarios := []scenario{
{
n: 0,
max: 0,
expected: 0,
},
{
n: 0,
max: 1,
expected: 0,
},
{
n: 1,
max: 0,
expected: 0,
},
{
n: 3,
max: 2,
expected: 1,
},
{
n: -1,
max: 2,
expected: 1,
},
}
for _, s := range scenarios {
if s.expected != ModuloWithWrap(s.n, s.max) {
t.Errorf("expected %d, got %d, for n: %d, max: %d", s.expected, ModuloWithWrap(s.n, s.max), s.n, s.max)
}
}
}