add integration test for deleting a range of lines in the staging panel

This commit is contained in:
Jesse Duffield 2022-01-18 19:44:41 +11:00
parent d019626342
commit dbb8b17d83
19 changed files with 236 additions and 0 deletions

View file

@ -0,0 +1 @@
file1

View file

@ -0,0 +1 @@
ref: refs/heads/master

View 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

View file

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

Binary file not shown.

View file

@ -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

View file

@ -0,0 +1 @@
0000000000000000000000000000000000000000 f793cf3fd99464dbd3499093e95197229b771b11 CI <CI@example.com> 1642495374 +1100 commit (initial): file1

View file

@ -0,0 +1 @@
0000000000000000000000000000000000000000 f793cf3fd99464dbd3499093e95197229b771b11 CI <CI@example.com> 1642495374 +1100 commit (initial): file1

View file

@ -0,0 +1 @@
f793cf3fd99464dbd3499093e95197229b771b11

View 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
}

View 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
}

View 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
}

View 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}]}

View 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

View file

@ -0,0 +1,4 @@
{
"description": "Some more line-by-line staging",
"speed": 20
}