1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-19 21:28:28 +02:00

Add tests of interactive rebase with custom comment character

This commit is contained in:
Gustavo Krieger 2023-07-02 00:21:17 -03:00
parent 7cb54f4fee
commit cff9850374
3 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,42 @@
package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DropWithCustomCommentChar = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Drops a commit with the 'core.commentChar' option set to a custom character",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.SetConfig("core.commentChar", ";")
shell.CreateNCommits(2)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Focus().
Lines(
Contains("commit 02").IsSelected(),
Contains("commit 01"),
).
Press(keys.Universal.Remove).
Tap(func() {
t.ExpectPopup().Confirmation().
Title(Equals("Delete commit")).
Content(Equals("Are you sure you want to delete this commit?")).
Confirm()
}).
// The following behavior requires correction:
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Contains("failed to parse line")).
Confirm()
}).
Lines(
Contains("commit 02").IsSelected(),
Contains("commit 01"),
)
},
})

View File

@ -0,0 +1,36 @@
package interactive_rebase
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var MoveWithCustomCommentChar = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Directly moves a commit down and back up with the 'core.commentChar' option set to a custom character",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.SetConfig("core.commentChar", ";")
shell.CreateNCommits(2)
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Focus().
Lines(
Contains("commit 02").IsSelected(),
Contains("commit 01"),
).
Press(keys.Commits.MoveDownCommit).
// The following behavior requires correction:
Tap(func() {
t.ExpectPopup().Alert().
Title(Equals("Error")).
Content(Contains("failed to parse line")).
Confirm()
}).
Lines(
Contains("commit 02").IsSelected(),
Contains("commit 01"),
)
},
})

View File

@ -103,6 +103,7 @@ var tests = []*components.IntegrationTest{
interactive_rebase.AmendNonHeadCommitDuringRebase,
interactive_rebase.DropTodoCommitWithUpdateRef,
interactive_rebase.DropTodoCommitWithUpdateRefShowBranchHeads,
interactive_rebase.DropWithCustomCommentChar,
interactive_rebase.EditFirstCommit,
interactive_rebase.EditNonTodoCommitDuringRebase,
interactive_rebase.EditTheConflCommit,
@ -110,6 +111,7 @@ var tests = []*components.IntegrationTest{
interactive_rebase.FixupSecondCommit,
interactive_rebase.Move,
interactive_rebase.MoveInRebase,
interactive_rebase.MoveWithCustomCommentChar,
interactive_rebase.PickRescheduled,
interactive_rebase.Rebase,
interactive_rebase.RewordCommitWithEditorAndFail,