forked from jesseduffield/lazygit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for resolving conflicts in a file without a trail…
…ing LF The test shows that the last line of the file is lost.
- Loading branch information
1 parent
72cf3ef
commit b71aa5e
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
pkg/integration/tests/conflicts/resolve_without_trailing_lf.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package conflicts | ||
|
||
import ( | ||
"github.com/jesseduffield/lazygit/pkg/config" | ||
. "github.com/jesseduffield/lazygit/pkg/integration/components" | ||
) | ||
|
||
var ResolveWithoutTrailingLf = NewIntegrationTest(NewIntegrationTestArgs{ | ||
Description: "Regression test for resolving a merge conflict when the file doesn't have a trailing newline", | ||
ExtraCmdArgs: []string{}, | ||
Skip: false, | ||
SetupConfig: func(config *config.AppConfig) {}, | ||
SetupRepo: func(shell *Shell) { | ||
shell. | ||
NewBranch("branch1"). | ||
CreateFileAndAdd("file", "a\n\nno eol"). | ||
Commit("initial commit"). | ||
UpdateFileAndAdd("file", "a1\n\nno eol"). | ||
Commit("commit on branch1"). | ||
NewBranchFrom("branch2", "HEAD^"). | ||
UpdateFileAndAdd("file", "a2\n\nno eol"). | ||
Commit("commit on branch2"). | ||
Checkout("branch1"). | ||
RunCommandExpectError([]string{"git", "merge", "--no-edit", "branch2"}) | ||
}, | ||
Run: func(t *TestDriver, keys config.KeybindingConfig) { | ||
t.Views().Files(). | ||
IsFocused(). | ||
Lines( | ||
Contains("UU file").IsSelected(), | ||
). | ||
PressEnter() | ||
|
||
t.Views().MergeConflicts(). | ||
IsFocused(). | ||
SelectedLines( | ||
Contains("<<<<<<< HEAD"), | ||
Contains("a1"), | ||
Contains("======="), | ||
). | ||
SelectNextItem(). | ||
PressPrimaryAction() | ||
|
||
t.ExpectPopup().Alert(). | ||
Title(Equals("Continue")). | ||
Content(Contains("All merge conflicts resolved. Continue?")). | ||
Cancel() | ||
|
||
t.Views().Files(). | ||
Focus(). | ||
Lines( | ||
Contains("M file").IsSelected(), | ||
) | ||
|
||
/* EXPECTED: | ||
t.Views().Main().Content(Contains("-a1\n+a2\n").DoesNotContain("-no eol")) | ||
ACTUAL: */ | ||
t.Views().Main().Content(Contains("-a1\n+a2\n").Contains("-no eol")) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters