diff options
author | Elwardi <elwardifadeli@gmail.com> | 2021-08-06 10:53:32 +0100 |
---|---|---|
committer | Elwardi <elwardifadeli@gmail.com> | 2021-08-06 10:53:32 +0100 |
commit | 906ec30cac9ea632006b295b30bca732498f81bc (patch) | |
tree | 1e353d4196f2b493b118a636fadbd7c884af426b /pkg/gui/gui_test.go | |
parent | a8ec044f0e52bff8921592fb4d334a4d6f4c7468 (diff) |
Minor changes to menuFromCommand prompts
Diffstat (limited to 'pkg/gui/gui_test.go')
-rw-r--r-- | pkg/gui/gui_test.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/pkg/gui/gui_test.go b/pkg/gui/gui_test.go index f3f798d03..d4e0415c7 100644 --- a/pkg/gui/gui_test.go +++ b/pkg/gui/gui_test.go @@ -83,12 +83,12 @@ func runCmdHeadless(cmd *exec.Cmd) error { func TestGuiGenerateMenuCandidates(t *testing.T) { type scenario struct { - testName string - cmdOut string - filter string - tFormat string - dFormat string - test func([]string, []string, error) + testName string + cmdOut string + filter string + valueFormat string + labelFormat string + test func([]CommandMenuEntry, error) } scenarios := []scenario{ @@ -98,10 +98,10 @@ func TestGuiGenerateMenuCandidates(t *testing.T) { "(?P<remote>[a-z_]+)/(?P<branch>.*)", "{{ .branch }}", "Remote: {{ .remote }}", - func(actualCandidate []string, actualDescr []string, err error) { + func(actualEntry []CommandMenuEntry, err error) { assert.NoError(t, err) - assert.EqualValues(t, "pr-1", actualCandidate[0]) - assert.EqualValues(t, "Remote: upstream", actualDescr[0]) + assert.EqualValues(t, "pr-1", actualEntry[0].value) + assert.EqualValues(t, "Remote: upstream", actualEntry[0].label) }, }, { @@ -110,10 +110,10 @@ func TestGuiGenerateMenuCandidates(t *testing.T) { "(?P<remote>[a-z]*)/(?P<branch>.*)", "{{ .branch }}|{{ .remote }}", "", - func(actualCandidate []string, actualDescr []string, err error) { + func(actualEntry []CommandMenuEntry, err error) { assert.NoError(t, err) - assert.EqualValues(t, "pr-1|upstream", actualCandidate[0]) - assert.EqualValues(t, "", actualDescr[0]) + assert.EqualValues(t, "pr-1|upstream", actualEntry[0].value) + assert.EqualValues(t, "", actualEntry[0].label) }, }, { @@ -122,17 +122,17 @@ func TestGuiGenerateMenuCandidates(t *testing.T) { "(?P<remote>[a-z]*)/(?P<branch>.*)", "{{ .group_2 }}|{{ .group_1 }}", "Remote: {{ .group_1 }}", - func(actualCandidate []string, actualDescr []string, err error) { + func(actualEntry []CommandMenuEntry, err error) { assert.NoError(t, err) - assert.EqualValues(t, "pr-1|upstream", actualCandidate[0]) - assert.EqualValues(t, "Remote: upstream", actualDescr[0]) + assert.EqualValues(t, "pr-1|upstream", actualEntry[0].value) + assert.EqualValues(t, "Remote: upstream", actualEntry[0].label) }, }, } for _, s := range scenarios { t.Run(s.testName, func(t *testing.T) { - s.test(NewDummyGui().GenerateMenuCandidates(s.cmdOut, s.filter, s.tFormat, s.dFormat)) + s.test(NewDummyGui().GenerateMenuCandidates(s.cmdOut, s.filter, s.valueFormat, s.labelFormat)) }) } } |