summaryrefslogtreecommitdiffstats
path: root/pkg/gui/presentation/commits_test.go
diff options
context:
space:
mode:
authorpikomonde <32364823+pikomonde@users.noreply.github.com>2024-03-20 03:15:20 +0700
committerStefan Haller <stefan@haller-berlin.de>2024-04-12 08:33:47 +0200
commit84333eebc3be466b23627f6709ad6b000ddd21f1 (patch)
tree0dc30763a0afb5abeabbe051e0c17771f4670b67 /pkg/gui/presentation/commits_test.go
parent7f6eea2a55ee6e17660c893a9322d743c5016caf (diff)
renaming variable to CommitHash
Diffstat (limited to 'pkg/gui/presentation/commits_test.go')
-rw-r--r--pkg/gui/presentation/commits_test.go276
1 files changed, 138 insertions, 138 deletions
diff --git a/pkg/gui/presentation/commits_test.go b/pkg/gui/presentation/commits_test.go
index f1f075f45..75f96eed9 100644
--- a/pkg/gui/presentation/commits_test.go
+++ b/pkg/gui/presentation/commits_test.go
@@ -22,38 +22,38 @@ func formatExpected(expected string) string {
func TestGetCommitListDisplayStrings(t *testing.T) {
scenarios := []struct {
- testName string
- commits []*models.Commit
- branches []*models.Branch
- currentBranchName string
- hasUpdateRefConfig bool
- fullDescription bool
- cherryPickedCommitShaSet *set.Set[string]
- markedBaseCommit string
- diffName string
- timeFormat string
- shortTimeFormat string
- now time.Time
- parseEmoji bool
- selectedCommitSha string
- startIdx int
- endIdx int
- showGraph bool
- bisectInfo *git_commands.BisectInfo
- showYouAreHereLabel bool
- expected string
- focus bool
+ testName string
+ commits []*models.Commit
+ branches []*models.Branch
+ currentBranchName string
+ hasUpdateRefConfig bool
+ fullDescription bool
+ cherryPickedCommitHashSet *set.Set[string]
+ markedBaseCommit string
+ diffName string
+ timeFormat string
+ shortTimeFormat string
+ now time.Time
+ parseEmoji bool
+ selectedCommitHash string
+ startIdx int
+ endIdx int
+ showGraph bool
+ bisectInfo *git_commands.BisectInfo
+ showYouAreHereLabel bool
+ expected string
+ focus bool
}{
{
- testName: "no commits",
- commits: []*models.Commit{},
- startIdx: 0,
- endIdx: 1,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
- expected: "",
+ testName: "no commits",
+ commits: []*models.Commit{},
+ startIdx: 0,
+ endIdx: 1,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ expected: "",
},
{
testName: "some commits",
@@ -61,12 +61,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit1", Sha: "sha1"},
{Name: "commit2", Sha: "sha2"},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 commit2
@@ -78,12 +78,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit1", Sha: "sha1", Tags: []string{"tag1", "tag2"}},
{Name: "commit2", Sha: "sha2"},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 tag1 tag2 commit1
sha2 commit2
@@ -103,14 +103,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "master", CommitHash: "sha3", Head: false},
{Name: "old-branch", CommitHash: "sha4", Head: false},
},
- currentBranchName: "current-branch",
- hasUpdateRefConfig: true,
- startIdx: 0,
- endIdx: 4,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ currentBranchName: "current-branch",
+ hasUpdateRefConfig: true,
+ startIdx: 0,
+ endIdx: 4,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 * commit2
@@ -128,14 +128,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "current-branch", CommitHash: "sha1", Head: true},
{Name: "other-branch", CommitHash: "sha1", Head: false},
},
- currentBranchName: "current-branch",
- hasUpdateRefConfig: true,
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ currentBranchName: "current-branch",
+ hasUpdateRefConfig: true,
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 * commit1
sha2 commit2
@@ -151,14 +151,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "current-branch", CommitHash: "sha1", Head: true},
{Name: "other-branch", CommitHash: "sha1", Head: false},
},
- currentBranchName: "current-branch",
- hasUpdateRefConfig: false,
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ currentBranchName: "current-branch",
+ hasUpdateRefConfig: false,
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 commit2
@@ -174,12 +174,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
branches: []*models.Branch{
{Name: "some-branch", CommitHash: "sha2"},
},
- startIdx: 0,
- endIdx: 3,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 3,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 commit1
sha2 * some-tag commit2
@@ -195,12 +195,12 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 ⏣─╮ commit1
sha2 ◯ │ commit2
@@ -218,13 +218,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -242,13 +242,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 1,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 1,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha2 pick commit2
sha3 ◯ <-- YOU ARE HERE --- commit3
@@ -265,13 +265,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 3,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 3,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha4 ◯ commit4
sha5 ◯ commit5
@@ -286,13 +286,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -307,13 +307,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 4,
- endIdx: 5,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 4,
+ endIdx: 5,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha5 ◯ commit5
`),
@@ -327,13 +327,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}, Action: todo.Pick},
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
},
- startIdx: 0,
- endIdx: 2,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: true,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: true,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 pick commit2
@@ -346,13 +346,13 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}},
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
},
- startIdx: 0,
- endIdx: 3,
- showGraph: true,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- showYouAreHereLabel: false,
- now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
+ startIdx: 0,
+ endIdx: 3,
+ showGraph: true,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ showYouAreHereLabel: false,
+ now: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
expected: formatExpected(`
sha1 pick commit1
sha2 ◯ commit2
@@ -365,15 +365,15 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
{Name: "commit1", Sha: "sha1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"},
{Name: "commit2", Sha: "sha2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"},
},
- fullDescription: true,
- timeFormat: "2006-01-02",
- shortTimeFormat: "3:04PM",
- startIdx: 0,
- endIdx: 2,
- showGraph: false,
- bisectInfo: git_commands.NewNullBisectInfo(),
- cherryPickedCommitShaSet: set.New[string](),
- now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC),
+ fullDescription: true,
+ timeFormat: "2006-01-02",
+ shortTimeFormat: "3:04PM",
+ startIdx: 0,
+ endIdx: 2,
+ showGraph: false,
+ bisectInfo: git_commands.NewNullBisectInfo(),
+ cherryPickedCommitHashSet: set.New[string](),
+ now: time.Date(2020, 1, 1, 5, 3, 4, 0, time.UTC),
expected: formatExpected(`
sha1 2:03AM Jesse Duffield commit1
sha2 2019-12-20 Jesse Duffield commit2
@@ -406,14 +406,14 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
s.currentBranchName,
s.hasUpdateRefConfig,
s.fullDescription,
- s.cherryPickedCommitShaSet,
+ s.cherryPickedCommitHashSet,
s.diffName,
s.markedBaseCommit,
s.timeFormat,
s.shortTimeFormat,
s.now,
s.parseEmoji,
- s.selectedCommitSha,
+ s.selectedCommitHash,
s.startIdx,
s.endIdx,
s.showGraph,