mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-21 12:16:54 +02:00
add multi-line commit integration test
This commit is contained in:
parent
abbd598992
commit
b40190bd94
@ -2,6 +2,7 @@ package components
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -56,6 +57,16 @@ func NotContains(target string) *matcher {
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MatchesRegexp(regexStr string) *matcher {
|
||||||
|
return &matcher{testFn: func(value string) (bool, string) {
|
||||||
|
matched, err := regexp.MatchString(regexStr, value)
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Sprintf("Unexpected error parsing regular expression '%s': %s", regexStr, err.Error())
|
||||||
|
}
|
||||||
|
return matched, fmt.Sprintf("Expected '%s' to match regular expression '%s'", value, regexStr)
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
func Equals(target string) *matcher {
|
func Equals(target string) *matcher {
|
||||||
return &matcher{testFn: func(value string) (bool, string) {
|
return &matcher{testFn: func(value string) (bool, string) {
|
||||||
return target == value, fmt.Sprintf("Expected '%s' to equal '%s'", value, target)
|
return target == value, fmt.Sprintf("Expected '%s' to equal '%s'", value, target)
|
||||||
|
34
pkg/integration/tests/commit/commit_multiline.go
Normal file
34
pkg/integration/tests/commit/commit_multiline.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package commit
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||||
|
)
|
||||||
|
|
||||||
|
var CommitMultiline = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
|
Description: "Commit with a multi-line commit message",
|
||||||
|
ExtraCmdArgs: "",
|
||||||
|
Skip: false,
|
||||||
|
SetupConfig: func(config *config.AppConfig) {},
|
||||||
|
SetupRepo: func(shell *Shell) {
|
||||||
|
shell.CreateFile("myfile", "myfile content")
|
||||||
|
},
|
||||||
|
Run: func(shell *Shell, input *Input, assert *Assert, keys config.KeybindingConfig) {
|
||||||
|
assert.CommitCount(0)
|
||||||
|
|
||||||
|
input.PrimaryAction()
|
||||||
|
input.PressKeys(keys.Files.CommitChanges)
|
||||||
|
|
||||||
|
input.Type("first line")
|
||||||
|
input.PressKeys(keys.Universal.AppendNewline)
|
||||||
|
input.PressKeys(keys.Universal.AppendNewline)
|
||||||
|
input.Type("third line")
|
||||||
|
input.Confirm()
|
||||||
|
|
||||||
|
assert.CommitCount(1)
|
||||||
|
assert.MatchHeadCommitMessage(Equals("first line"))
|
||||||
|
|
||||||
|
input.SwitchToCommitsWindow()
|
||||||
|
assert.MatchMainViewContent(MatchesRegexp("first line\n\\s*\n\\s*third line"))
|
||||||
|
},
|
||||||
|
})
|
@ -36,6 +36,7 @@ var tests = []*components.IntegrationTest{
|
|||||||
cherry_pick.CherryPick,
|
cherry_pick.CherryPick,
|
||||||
cherry_pick.CherryPickConflicts,
|
cherry_pick.CherryPickConflicts,
|
||||||
commit.Commit,
|
commit.Commit,
|
||||||
|
commit.CommitMultiline,
|
||||||
commit.NewBranch,
|
commit.NewBranch,
|
||||||
commit.Staged,
|
commit.Staged,
|
||||||
commit.Unstaged,
|
commit.Unstaged,
|
||||||
|
Binary file not shown.
@ -1,5 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 176069f0ded1db43eecb3b629a6077dba6c68295 CI <CI@example.com> 1645602422 +1100 commit (initial): myfile1
|
|
||||||
176069f0ded1db43eecb3b629a6077dba6c68295 9f1b5440546da24daad7014ccf3e1f4d81f9414b CI <CI@example.com> 1645602422 +1100 commit: myfile2
|
|
||||||
9f1b5440546da24daad7014ccf3e1f4d81f9414b 3933a268c502712421b7bfa04888319d6f108574 CI <CI@example.com> 1645602422 +1100 commit: myfile3
|
|
||||||
3933a268c502712421b7bfa04888319d6f108574 37128a3020849daa0847462d14c384cc74c42ae0 CI <CI@example.com> 1645602422 +1100 commit: myfile4
|
|
||||||
37128a3020849daa0847462d14c384cc74c42ae0 574013716a7f007a27b647b90cdbc78d006d792b CI <CI@example.com> 1645602427 +1100 commit: first line
|
|
@ -1,5 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 176069f0ded1db43eecb3b629a6077dba6c68295 CI <CI@example.com> 1645602422 +1100 commit (initial): myfile1
|
|
||||||
176069f0ded1db43eecb3b629a6077dba6c68295 9f1b5440546da24daad7014ccf3e1f4d81f9414b CI <CI@example.com> 1645602422 +1100 commit: myfile2
|
|
||||||
9f1b5440546da24daad7014ccf3e1f4d81f9414b 3933a268c502712421b7bfa04888319d6f108574 CI <CI@example.com> 1645602422 +1100 commit: myfile3
|
|
||||||
3933a268c502712421b7bfa04888319d6f108574 37128a3020849daa0847462d14c384cc74c42ae0 CI <CI@example.com> 1645602422 +1100 commit: myfile4
|
|
||||||
37128a3020849daa0847462d14c384cc74c42ae0 574013716a7f007a27b647b90cdbc78d006d792b CI <CI@example.com> 1645602427 +1100 commit: first line
|
|
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
x�ÍA
|
|
||||||
ƒ0@Ñ®sŠÙÊL:Ž))¸ò1™PÁ!")ØÛ×#tûyðS5[Ë¥íª€*©`”¹hÈÌJAr ©ô<ó=—˜:ïâ§½ëãÏqzém[õ–ª
@Â� gïáJ„èÎzNšþÉ�}˲*¹.Ñ,¹
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
x�ŽK
|
|
||||||
Ã0D»ö)¼/YVbJ)d•c(²BùáºÐã7Ðt5ÃcŒìëš«Eè.µ¨Zì„=E7%�ÔŒ€¬,Ó0¥I‘ÉûQÍÁE·j}pÙB¤.1Ÿ¨ÅäH|$‘@B§†ßuÞ‹í{~x=½É¾>¬k©i ƒ½:`NzžªúçÜL¹¼ª]ò¦ÆÔ9—ôë_�!?’
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
574013716a7f007a27b647b90cdbc78d006d792b
|
|
@ -1 +0,0 @@
|
|||||||
test1
|
|
@ -1 +0,0 @@
|
|||||||
test2
|
|
@ -1 +0,0 @@
|
|||||||
test3
|
|
@ -1 +0,0 @@
|
|||||||
test4
|
|
@ -1 +0,0 @@
|
|||||||
test5
|
|
@ -1 +0,0 @@
|
|||||||
{"KeyEvents":[{"Timestamp":931,"Mod":0,"Key":256,"Ch":32},{"Timestamp":1467,"Mod":0,"Key":256,"Ch":99},{"Timestamp":2035,"Mod":0,"Key":256,"Ch":102},{"Timestamp":2090,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2162,"Mod":0,"Key":256,"Ch":114},{"Timestamp":2259,"Mod":0,"Key":256,"Ch":115},{"Timestamp":2314,"Mod":0,"Key":256,"Ch":116},{"Timestamp":2411,"Mod":0,"Key":256,"Ch":32},{"Timestamp":2546,"Mod":0,"Key":256,"Ch":108},{"Timestamp":2578,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2627,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2691,"Mod":0,"Key":256,"Ch":101},{"Timestamp":3358,"Mod":4,"Key":13,"Ch":13},{"Timestamp":3577,"Mod":4,"Key":13,"Ch":13},{"Timestamp":3810,"Mod":0,"Key":256,"Ch":116},{"Timestamp":3874,"Mod":0,"Key":256,"Ch":104},{"Timestamp":3914,"Mod":0,"Key":256,"Ch":105},{"Timestamp":3986,"Mod":0,"Key":256,"Ch":114},{"Timestamp":4107,"Mod":0,"Key":256,"Ch":100},{"Timestamp":4195,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4291,"Mod":0,"Key":256,"Ch":108},{"Timestamp":4322,"Mod":0,"Key":256,"Ch":105},{"Timestamp":4370,"Mod":0,"Key":256,"Ch":110},{"Timestamp":4426,"Mod":0,"Key":256,"Ch":101},{"Timestamp":4603,"Mod":0,"Key":13,"Ch":13},{"Timestamp":5267,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}
|
|
@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd $1
|
|
||||||
|
|
||||||
git init
|
|
||||||
|
|
||||||
git config user.email "CI@example.com"
|
|
||||||
git config user.name "CI"
|
|
||||||
|
|
||||||
echo test1 > myfile1
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile1"
|
|
||||||
echo test2 > myfile2
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile2"
|
|
||||||
echo test3 > myfile3
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile3"
|
|
||||||
echo test4 > myfile4
|
|
||||||
git add .
|
|
||||||
git commit -am "myfile4"
|
|
||||||
echo test5 > myfile5
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "stage a file and commit the change with a multiline commit message",
|
|
||||||
"speed": 15
|
|
||||||
}
|
|
@ -8,3 +8,7 @@
|
|||||||
[user]
|
[user]
|
||||||
email = CI@example.com
|
email = CI@example.com
|
||||||
name = CI
|
name = CI
|
||||||
|
[commit]
|
||||||
|
gpgSign = false
|
||||||
|
[protocol "file"]
|
||||||
|
allow = always
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
0000000000000000000000000000000000000000 f5b4b9b810f0c3d13754db99d24b04de451f8cec CI <CI@example.com> 1671534726 +1100 commit (initial): first line
|
@ -0,0 +1 @@
|
|||||||
|
0000000000000000000000000000000000000000 f5b4b9b810f0c3d13754db99d24b04de451f8cec CI <CI@example.com> 1671534726 +1100 commit (initial): first line
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
f5b4b9b810f0c3d13754db99d24b04de451f8cec
|
@ -0,0 +1 @@
|
|||||||
|
myfile content
|
Loading…
x
Reference in New Issue
Block a user