mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
add integration test for deleting a range of lines in the staging panel
This commit is contained in:
parent
d019626342
commit
dbb8b17d83
19 changed files with 236 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
file1
|
1
test/integration/stagingTwo/expected/.git_keep/HEAD
Normal file
1
test/integration/stagingTwo/expected/.git_keep/HEAD
Normal file
|
@ -0,0 +1 @@
|
|||
ref: refs/heads/master
|
10
test/integration/stagingTwo/expected/.git_keep/config
Normal file
10
test/integration/stagingTwo/expected/.git_keep/config
Normal file
|
@ -0,0 +1,10 @@
|
|||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
ignorecase = true
|
||||
precomposeunicode = true
|
||||
[user]
|
||||
email = CI@example.com
|
||||
name = CI
|
|
@ -0,0 +1 @@
|
|||
Unnamed repository; edit this file 'description' to name the repository.
|
BIN
test/integration/stagingTwo/expected/.git_keep/index
Normal file
BIN
test/integration/stagingTwo/expected/.git_keep/index
Normal file
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
# git ls-files --others --exclude-from=.git/info/exclude
|
||||
# Lines that start with '#' are comments.
|
||||
# For a project mostly in C, the following would be a good set of
|
||||
# exclude patterns (uncomment them if you want to use them):
|
||||
# *.[oa]
|
||||
# *~
|
||||
.DS_Store
|
1
test/integration/stagingTwo/expected/.git_keep/logs/HEAD
Normal file
1
test/integration/stagingTwo/expected/.git_keep/logs/HEAD
Normal file
|
@ -0,0 +1 @@
|
|||
0000000000000000000000000000000000000000 f793cf3fd99464dbd3499093e95197229b771b11 CI <CI@example.com> 1642495374 +1100 commit (initial): file1
|
|
@ -0,0 +1 @@
|
|||
0000000000000000000000000000000000000000 f793cf3fd99464dbd3499093e95197229b771b11 CI <CI@example.com> 1642495374 +1100 commit (initial): file1
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
f793cf3fd99464dbd3499093e95197229b771b11
|
64
test/integration/stagingTwo/expected/one.txt
Normal file
64
test/integration/stagingTwo/expected/one.txt
Normal file
|
@ -0,0 +1,64 @@
|
|||
package oscommands
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
)
|
||||
|
||||
// NewDummyOSCommand creates a new dummy OSCommand for testing
|
||||
func NewDummyOSCommand() *OSCommand {
|
||||
osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog()))
|
||||
|
||||
return osCmd
|
||||
}
|
||||
|
||||
type OSCommandDeps struct {
|
||||
Common *common.Common
|
||||
Platform *Platform
|
||||
GetenvFn func(string) string
|
||||
RemoveFileFn func(string) error
|
||||
Cmd *CmdObjBuilder
|
||||
}
|
||||
|
||||
func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand {
|
||||
common := deps.Common
|
||||
if common == nil {
|
||||
common = utils.NewDummyCommon()
|
||||
}
|
||||
|
||||
platform := deps.Platform
|
||||
if platform == nil {
|
||||
platform = dummyPlatform
|
||||
}
|
||||
|
||||
return &OSCommand{
|
||||
Common: common,
|
||||
Platform: platform,
|
||||
getenvFn: deps.GetenvFn,
|
||||
removeFileFn: deps.RemoveFileFn,
|
||||
guiIO: NewNullGuiIO(utils.NewDummyLog()),
|
||||
Cmd: deps.Cmd,
|
||||
}
|
||||
}
|
||||
|
||||
func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder {
|
||||
return &CmdObjBuilder{
|
||||
runner: runner,
|
||||
platform: dummyPlatform,
|
||||
}
|
||||
}
|
||||
|
||||
var dummyPlatform = &Platform{
|
||||
OS: "darwin",
|
||||
Shell: "bash",
|
||||
ShellArg: "-c",
|
||||
OpenCommand: "open {{filename}}",
|
||||
OpenLinkCommand: "open {{link}}",
|
||||
}
|
||||
|
||||
func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand {
|
||||
osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog()))
|
||||
osCommand.Cmd = NewDummyCmdObjBuilder(runner)
|
||||
|
||||
return osCommand
|
||||
}
|
63
test/integration/stagingTwo/files/one.txt
Normal file
63
test/integration/stagingTwo/files/one.txt
Normal file
|
@ -0,0 +1,63 @@
|
|||
package oscommands
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
)
|
||||
|
||||
// NewDummyOSCommand creates a new dummy OSCommand for testing
|
||||
func NewDummyOSCommand() *OSCommand {
|
||||
osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog()))
|
||||
|
||||
return osCmd
|
||||
}
|
||||
|
||||
type OSCommandDeps struct {
|
||||
Common *common.Common
|
||||
Platform *Platform
|
||||
GetenvFn func(string) string
|
||||
RemoveFileFn func(string) error
|
||||
Cmd *CmdObjBuilder
|
||||
}
|
||||
|
||||
func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand {
|
||||
common := deps.Common
|
||||
if common == nil {
|
||||
common = utils.NewDummyCommon()
|
||||
}
|
||||
|
||||
platform := deps.Platform
|
||||
if platform == nil {
|
||||
platform = dummyPlatform
|
||||
}
|
||||
|
||||
return &OSCommand{
|
||||
Common: common,
|
||||
Platform: platform,
|
||||
getenvFn: deps.GetenvFn,
|
||||
removeFileFn: deps.RemoveFileFn,
|
||||
guiIO: NewNullGuiIO(utils.NewDummyLog()),
|
||||
}
|
||||
}
|
||||
|
||||
func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder {
|
||||
return &CmdObjBuilder{
|
||||
runner: runner,
|
||||
platform: dummyPlatform,
|
||||
}
|
||||
}
|
||||
|
||||
var dummyPlatform = &Platform{
|
||||
OS: "darwin",
|
||||
Shell: "bash",
|
||||
ShellArg: "-c",
|
||||
OpenCommand: "open {{filename}}",
|
||||
OpenLinkCommand: "open {{link}}",
|
||||
}
|
||||
|
||||
func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand {
|
||||
osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog()))
|
||||
osCommand.Cmd = NewDummyCmdObjBuilder(runner)
|
||||
|
||||
return osCommand
|
||||
}
|
67
test/integration/stagingTwo/files/one_new.txt
Normal file
67
test/integration/stagingTwo/files/one_new.txt
Normal file
|
@ -0,0 +1,67 @@
|
|||
package oscommands
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
)
|
||||
|
||||
// NewDummyOSCommand creates a new dummy OSCommand for testing
|
||||
func NewDummyOSCommand() *OSCommand {
|
||||
osCmd := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog()))
|
||||
|
||||
return osCmd
|
||||
}
|
||||
|
||||
type OSCommandDeps struct {
|
||||
Common *common.Common
|
||||
Platform *Platform
|
||||
GetenvFn func(string) string
|
||||
RemoveFileFn func(string) error
|
||||
Cmd *CmdObjBuilder
|
||||
}
|
||||
|
||||
func NewDummyOSCommandWithDeps(deps OSCommandDeps) *OSCommand {
|
||||
if deps.Cmd == nil {
|
||||
panic("WHAT")
|
||||
}
|
||||
common := deps.Common
|
||||
if common == nil {
|
||||
common = utils.NewDummyCommon()
|
||||
}
|
||||
|
||||
platform := deps.Platform
|
||||
if platform == nil {
|
||||
platform = dummyPlatform
|
||||
}
|
||||
|
||||
return &OSCommand{
|
||||
Common: common,
|
||||
Platform: platform,
|
||||
getenvFn: deps.GetenvFn,
|
||||
removeFileFn: deps.RemoveFileFn,
|
||||
guiIO: NewNullGuiIO(utils.NewDummyLog()),
|
||||
Cmd: deps.Cmd,
|
||||
}
|
||||
}
|
||||
|
||||
func NewDummyCmdObjBuilder(runner ICmdObjRunner) *CmdObjBuilder {
|
||||
return &CmdObjBuilder{
|
||||
runner: runner,
|
||||
platform: dummyPlatform,
|
||||
}
|
||||
}
|
||||
|
||||
var dummyPlatform = &Platform{
|
||||
OS: "darwin",
|
||||
Shell: "bash",
|
||||
ShellArg: "-c",
|
||||
OpenCommand: "open {{filename}}",
|
||||
OpenLinkCommand: "open {{link}}",
|
||||
}
|
||||
|
||||
func NewDummyOSCommandWithRunner(runner *FakeCmdObjRunner) *OSCommand {
|
||||
osCommand := NewOSCommand(utils.NewDummyCommon(), dummyPlatform, NewNullGuiIO(utils.NewDummyLog()))
|
||||
osCommand.Cmd = NewDummyCmdObjBuilder(runner)
|
||||
|
||||
return osCommand
|
||||
}
|
1
test/integration/stagingTwo/recording.json
Normal file
1
test/integration/stagingTwo/recording.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"KeyEvents":[{"Timestamp":843,"Mod":0,"Key":13,"Ch":13},{"Timestamp":1122,"Mod":0,"Key":256,"Ch":118},{"Timestamp":1266,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1386,"Mod":0,"Key":258,"Ch":0},{"Timestamp":1602,"Mod":0,"Key":256,"Ch":100},{"Timestamp":1851,"Mod":0,"Key":13,"Ch":13},{"Timestamp":2520,"Mod":0,"Key":27,"Ch":0},{"Timestamp":3195,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}
|
14
test/integration/stagingTwo/setup.sh
Normal file
14
test/integration/stagingTwo/setup.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd $1
|
||||
|
||||
git init
|
||||
|
||||
git config user.email "CI@example.com"
|
||||
git config user.name "CI"
|
||||
|
||||
cp ../files/one.txt one.txt
|
||||
git add .
|
||||
git commit -am file1
|
||||
|
||||
cp ../files/one_new.txt one.txt
|
4
test/integration/stagingTwo/test.json
Normal file
4
test/integration/stagingTwo/test.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"description": "Some more line-by-line staging",
|
||||
"speed": 20
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue