gopass/internal/editor/editor_test.go
Dominik Schulz 0ebf65fa2d
Fix vim detection. Again. (#2456)
Fixes #2424

RELEASE_NOTES=[BUGFIX] Fix vim invocation.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-07 09:08:45 +01:00

29 lines
786 B
Go

package editor
import (
"runtime"
"testing"
"github.com/stretchr/testify/assert"
)
func TestVimArgs(t *testing.T) {
t.Parallel()
if runtime.GOOS != "linux" {
t.Skip("not supported")
}
for ed, args := range map[string][]string{
"vi": {"-c", "autocmd BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile viminfo=\"\"", "-i", "NONE", "-n"},
"nvi": {},
"neovim": {"-c", "autocmd BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile shada=\"\"", "-i", "NONE", "-n"},
"vim": {"-c", "autocmd BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile viminfo=\"\"", "-i", "NONE", "-n"},
} {
if ed == "vi" && !isVim(ed) {
args = []string{}
}
assert.Equal(t, args, vimOptions(ed), ed)
}
}