mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-27 12:32:37 +02:00
verify that VISUAL,EDITOR,LGCC envvars are set for non-interactive commands
This commit is contained in:
parent
fb156bcaac
commit
c6cb90e8ca
@ -5,6 +5,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -2101,6 +2102,37 @@ func TestGitCommandCreateFixupCommit(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestGitCommandSkipEditorCommand confirms that SkipEditorCommand injects
|
||||||
|
// environment variables that suppress an interactive editor
|
||||||
|
func TestGitCommandSkipEditorCommand(t *testing.T) {
|
||||||
|
cmd := NewDummyGitCommand()
|
||||||
|
|
||||||
|
cmd.OSCommand.SetBeforeExecuteCmd(func(cmd *exec.Cmd) {
|
||||||
|
test.AssertContainsMatch(
|
||||||
|
t,
|
||||||
|
cmd.Env,
|
||||||
|
regexp.MustCompile("^VISUAL="),
|
||||||
|
"expected VISUAL to be set for a non-interactive external command",
|
||||||
|
)
|
||||||
|
|
||||||
|
test.AssertContainsMatch(
|
||||||
|
t,
|
||||||
|
cmd.Env,
|
||||||
|
regexp.MustCompile("^EDITOR="),
|
||||||
|
"expected EDITOR to be set for a non-interactive external command",
|
||||||
|
)
|
||||||
|
|
||||||
|
test.AssertContainsMatch(
|
||||||
|
t,
|
||||||
|
cmd.Env,
|
||||||
|
regexp.MustCompile("^LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY$"),
|
||||||
|
"expected LAZYGIT_CLIENT_COMMAND to be set for a non-interactive external command",
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
cmd.RunSkipEditorCommand("true")
|
||||||
|
}
|
||||||
|
|
||||||
func TestFindDotGitDir(t *testing.T) {
|
func TestFindDotGitDir(t *testing.T) {
|
||||||
type scenario struct {
|
type scenario struct {
|
||||||
testName string
|
testName string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user