1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-25 22:32:13 +02:00

more generics

This commit is contained in:
Jesse Duffield
2022-03-19 16:34:46 +11:00
parent eda8f4a5d4
commit bf4f06ab4e
21 changed files with 303 additions and 198 deletions

View File

@@ -38,13 +38,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
focus bool
}{
{
testName: "no commits",
commits: []*models.Commit{},
startIdx: 0,
length: 1,
showGraph: false,
bisectInfo: git_commands.NewNullBisectInfo(),
expected: "",
testName: "no commits",
commits: []*models.Commit{},
startIdx: 0,
length: 1,
showGraph: false,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: "",
},
{
testName: "some commits",
@@ -52,10 +53,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit1", Sha: "sha1"},
{Name: "commit2", Sha: "sha2"},
},
startIdx: 0,
length: 2,
showGraph: false,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 0,
length: 2,
showGraph: false,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha1 commit1
sha2 commit2
@@ -70,10 +72,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
startIdx: 0,
length: 5,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 0,
length: 5,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha1 ⏣─╮ commit1
sha2 ◯ │ commit2
@@ -91,10 +94,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
startIdx: 0,
length: 5,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 0,
length: 5,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -112,10 +116,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
startIdx: 1,
length: 10,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 1,
length: 10,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha2 pick commit2
sha3 ◯ commit3
@@ -132,10 +137,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
startIdx: 3,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 3,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha4 ◯ commit4
sha5 ◯ commit5
@@ -150,10 +156,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
startIdx: 0,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 0,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -168,10 +175,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
startIdx: 4,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 4,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha5 ◯ commit5
`),
@@ -185,10 +193,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}, Action: "pick"},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
startIdx: 0,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
startIdx: 0,
length: 2,
showGraph: true,
bisectInfo: git_commands.NewNullBisectInfo(),
cherryPickedCommitShaSet: set.New[string](),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2