mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-04 22:34:39 +02:00
another integration test
This commit is contained in:
parent
d7c79ba20b
commit
56f2ecb06c
@ -0,0 +1 @@
|
|||||||
|
file1
|
@ -0,0 +1 @@
|
|||||||
|
ref: refs/heads/master
|
@ -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.
|
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
|
@ -0,0 +1 @@
|
|||||||
|
0000000000000000000000000000000000000000 1854ab416d299cda0227d62b9ab0765e5551ef57 CI <CI@example.com> 1642499804 +1100 commit (initial): file1
|
@ -0,0 +1 @@
|
|||||||
|
0000000000000000000000000000000000000000 1854ab416d299cda0227d62b9ab0765e5551ef57 CI <CI@example.com> 1642499804 +1100 commit (initial): file1
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
1854ab416d299cda0227d62b9ab0765e5551ef57
|
@ -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
|
||||||
|
}
|
63
test/integration/staginWithDiffContextChange/files/one.txt
Normal file
63
test/integration/staginWithDiffContextChange/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
|
||||||
|
}
|
@ -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
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{"KeyEvents":[{"Timestamp":1395,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3036,"Mod":0,"Key":256,"Ch":125},{"Timestamp":3283,"Mod":0,"Key":256,"Ch":125},{"Timestamp":3483,"Mod":0,"Key":256,"Ch":125},{"Timestamp":3996,"Mod":0,"Key":256,"Ch":32},{"Timestamp":4629,"Mod":0,"Key":258,"Ch":0},{"Timestamp":5004,"Mod":0,"Key":258,"Ch":0},{"Timestamp":5067,"Mod":0,"Key":256,"Ch":118},{"Timestamp":5547,"Mod":0,"Key":257,"Ch":0},{"Timestamp":5867,"Mod":0,"Key":256,"Ch":118},{"Timestamp":6492,"Mod":0,"Key":256,"Ch":118},{"Timestamp":6628,"Mod":0,"Key":257,"Ch":0},{"Timestamp":6762,"Mod":0,"Key":257,"Ch":0},{"Timestamp":7779,"Mod":0,"Key":256,"Ch":125},{"Timestamp":8179,"Mod":0,"Key":256,"Ch":125},{"Timestamp":8723,"Mod":0,"Key":256,"Ch":32},{"Timestamp":9531,"Mod":0,"Key":259,"Ch":0},{"Timestamp":10170,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10379,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10500,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10833,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10849,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10865,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10881,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10898,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10915,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10931,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10947,"Mod":0,"Key":258,"Ch":0},{"Timestamp":10964,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11156,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11308,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11435,"Mod":0,"Key":256,"Ch":118},{"Timestamp":11571,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11700,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11828,"Mod":0,"Key":258,"Ch":0},{"Timestamp":11963,"Mod":0,"Key":258,"Ch":0},{"Timestamp":12083,"Mod":0,"Key":258,"Ch":0},{"Timestamp":12603,"Mod":0,"Key":256,"Ch":32},{"Timestamp":13051,"Mod":0,"Key":9,"Ch":9},{"Timestamp":14820,"Mod":0,"Key":256,"Ch":118},{"Timestamp":15028,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15139,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15266,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15387,"Mod":0,"Key":258,"Ch":0},{"Timestamp":15500,"Mod":0,"Key":258,"Ch":0},{"Timestamp":16266,"Mod":0,"Key":256,"Ch":125},{"Timestamp":16483,"Mod":0,"Key":256,"Ch":125},{"Timestamp":16747,"Mod":0,"Key":256,"Ch":125},{"Timestamp":17412,"Mod":0,"Key":256,"Ch":32},{"Timestamp":19124,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":272,"Height":74}]}
|
14
test/integration/staginWithDiffContextChange/setup.sh
Normal file
14
test/integration/staginWithDiffContextChange/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/staginWithDiffContextChange/test.json
Normal file
4
test/integration/staginWithDiffContextChange/test.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"description": "Staging a file and also changing the diff context",
|
||||||
|
"speed": 20
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user