mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 23:56:24 -04:00
Adapt tests for custom commands to work on Windows
The "touch" command isn't available on Windows, but "copy NUL file" seems to be a good approximation.
This commit is contained in:
parent
7274d86d54
commit
c426df91f3
|
|
@ -1,6 +1,8 @@
|
|||
package custom_commands
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
|
@ -14,6 +16,10 @@ var BasicCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
},
|
||||
SetupConfig: func(cfg *config.AppConfig) {},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
cmd := "touch file.txt"
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd = "copy NUL file.txt"
|
||||
}
|
||||
t.Views().Files().
|
||||
IsEmpty().
|
||||
IsFocused().
|
||||
|
|
@ -21,7 +27,7 @@ var BasicCmdAtRuntime = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Custom command:")).
|
||||
Type("touch file.txt").
|
||||
Type(cmd).
|
||||
Confirm()
|
||||
|
||||
t.GlobalPress(keys.Files.RefreshFiles)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package custom_commands
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
|
@ -13,11 +15,15 @@ var BasicCmdFromConfig = NewIntegrationTest(NewIntegrationTestArgs{
|
|||
shell.EmptyCommit("blah")
|
||||
},
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cmd := "touch myfile"
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd = "copy NUL myfile"
|
||||
}
|
||||
cfg.UserConfig.CustomCommands = []config.CustomCommand{
|
||||
{
|
||||
Key: "a",
|
||||
Context: "files",
|
||||
Command: "touch myfile",
|
||||
Command: cmd,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue