mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-01 00:54:58 +02:00
Add test demonstrating a bug with preserving the commit message
SplitCommitMessageAndDescription splits at the first '\n\n' that it finds (if there is one), which in this case is between the two paragraphs of the description. This is wrong.
This commit is contained in:
48
pkg/integration/tests/commit/preserve_commit_message.go
Normal file
48
pkg/integration/tests/commit/preserve_commit_message.go
Normal file
@ -0,0 +1,48 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var PreserveCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Test that the commit message is preserved correctly when canceling the commit message panel",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateFileAndAdd("myfile", "myfile content")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
InitialText(Equals("")).
|
||||
Type("my commit message").
|
||||
SwitchToDescription().
|
||||
Type("first paragraph").
|
||||
AddNewline().
|
||||
AddNewline().
|
||||
Type("second paragraph").
|
||||
Cancel()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
/* EXPECTED:
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Content(Equals("my commit message")).
|
||||
SwitchToDescription().
|
||||
Content(Equals("first paragraph\n\nsecond paragraph"))
|
||||
|
||||
ACTUAL:
|
||||
*/
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Content(Equals("my commit message\nfirst paragraph")).
|
||||
SwitchToDescription().
|
||||
Content(Equals("second paragraph"))
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user