diff options
author | Ryooooooga <eial5q265e5@gmail.com> | 2022-04-22 21:54:03 +0900 |
---|---|---|
committer | Ryooooooga <eial5q265e5@gmail.com> | 2022-04-23 17:39:12 +0900 |
commit | e5730cb80bffe835725f94d40e7ea28838f45f91 (patch) | |
tree | 762c2c0c83ccfbc36b6891befc9463439aa5e6e6 /pkg/commands/git_commands/file_test.go | |
parent | 8b103b16bd3a06d0e661e507832459fae7ec1198 (diff) |
fix: improve default editCommandTemplate
Diffstat (limited to 'pkg/commands/git_commands/file_test.go')
-rw-r--r-- | pkg/commands/git_commands/file_test.go | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/pkg/commands/git_commands/file_test.go b/pkg/commands/git_commands/file_test.go index 61482054b..4b9128dfe 100644 --- a/pkg/commands/git_commands/file_test.go +++ b/pkg/commands/git_commands/file_test.go @@ -47,7 +47,7 @@ func TestEditFileCmdStr(t *testing.T) { gitConfigMockResponses: nil, test: func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, `nano +1 "test"`, cmdStr) + assert.Equal(t, `nano "test"`, cmdStr) }, }, { @@ -61,7 +61,7 @@ func TestEditFileCmdStr(t *testing.T) { gitConfigMockResponses: map[string]string{"core.editor": "nano"}, test: func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, `nano +1 "test"`, cmdStr) + assert.Equal(t, `nano "test"`, cmdStr) }, }, { @@ -79,7 +79,7 @@ func TestEditFileCmdStr(t *testing.T) { gitConfigMockResponses: nil, test: func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, `nano +1 "test"`, cmdStr) + assert.Equal(t, `nano "test"`, cmdStr) }, }, { @@ -97,7 +97,7 @@ func TestEditFileCmdStr(t *testing.T) { gitConfigMockResponses: nil, test: func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, `emacs +1 "test"`, cmdStr) + assert.Equal(t, `emacs "test"`, cmdStr) }, }, { @@ -112,7 +112,7 @@ func TestEditFileCmdStr(t *testing.T) { gitConfigMockResponses: nil, test: func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, `vi +1 "test"`, cmdStr) + assert.Equal(t, `vi "test"`, cmdStr) }, }, { @@ -127,7 +127,7 @@ func TestEditFileCmdStr(t *testing.T) { gitConfigMockResponses: nil, test: func(cmdStr string, err error) { assert.NoError(t, err) - assert.Equal(t, `vi +1 "file/with space"`, cmdStr) + assert.Equal(t, `vi "file/with space"`, cmdStr) }, }, { @@ -144,6 +144,20 @@ func TestEditFileCmdStr(t *testing.T) { assert.Equal(t, `vim +1 "open file/at line"`, cmdStr) }, }, + { + filename: "default edit command template", + configEditCommand: "vim", + configEditCommandTemplate: "", + runner: oscommands.NewFakeRunner(t), + getenv: func(env string) string { + return "" + }, + gitConfigMockResponses: nil, + test: func(cmdStr string, err error) { + assert.NoError(t, err) + assert.Equal(t, `vim +1 -- "default edit command template"`, cmdStr) + }, + }, } for _, s := range scenarios { |