diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/oscommands/os_test.go | 18 | ||||
-rw-r--r-- | pkg/commands/pull_request_test.go | 40 |
2 files changed, 29 insertions, 29 deletions
diff --git a/pkg/commands/oscommands/os_test.go b/pkg/commands/oscommands/os_test.go index 2f015c21c..3769df071 100644 --- a/pkg/commands/oscommands/os_test.go +++ b/pkg/commands/oscommands/os_test.go @@ -80,8 +80,8 @@ func TestOSCommandOpenFile(t *testing.T) { { "test", func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "open", name) - assert.Equal(t, []string{"test"}, arg) + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `open "test"`}, arg) return secureexec.Command("echo") }, func(err error) { @@ -91,8 +91,8 @@ func TestOSCommandOpenFile(t *testing.T) { { "filename with spaces", func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "open", name) - assert.Equal(t, []string{"filename with spaces"}, arg) + assert.Equal(t, "bash", name) + assert.Equal(t, []string{"-c", `open "filename with spaces"`}, arg) return secureexec.Command("echo") }, func(err error) { @@ -132,7 +132,7 @@ func TestOSCommandOpenFileLinux(t *testing.T) { { "test", func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) + assert.Equal(t, "bash", name) assert.Equal(t, []string{"-c", "xdg-open \"test\" > /dev/null"}, arg) return secureexec.Command("echo") }, @@ -143,7 +143,7 @@ func TestOSCommandOpenFileLinux(t *testing.T) { { "filename with spaces", func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) + assert.Equal(t, "bash", name) assert.Equal(t, []string{"-c", "xdg-open \"filename with spaces\" > /dev/null"}, arg) return secureexec.Command("echo") }, @@ -154,7 +154,7 @@ func TestOSCommandOpenFileLinux(t *testing.T) { { "let's_test_with_single_quote", func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) + assert.Equal(t, "bash", name) assert.Equal(t, []string{"-c", "xdg-open \"let's_test_with_single_quote\" > /dev/null"}, arg) return secureexec.Command("echo") }, @@ -165,7 +165,7 @@ func TestOSCommandOpenFileLinux(t *testing.T) { { "$USER.txt", func(name string, arg ...string) *exec.Cmd { - assert.Equal(t, "sh", name) + assert.Equal(t, "bash", name) assert.Equal(t, []string{"-c", "xdg-open \"\\$USER.txt\" > /dev/null"}, arg) return secureexec.Command("echo") }, @@ -179,7 +179,7 @@ func TestOSCommandOpenFileLinux(t *testing.T) { OSCmd := NewDummyOSCommand() OSCmd.Command = s.command OSCmd.Platform.OS = "linux" - OSCmd.Config.GetUserConfig().OS.OpenCommand = `sh -c "xdg-open {{filename}} > /dev/null"` + OSCmd.Config.GetUserConfig().OS.OpenCommand = `xdg-open {{filename}} > /dev/null` s.test(OSCmd.OpenFile(s.filename)) } diff --git a/pkg/commands/pull_request_test.go b/pkg/commands/pull_request_test.go index 2db5b8ade..9015fb8eb 100644 --- a/pkg/commands/pull_request_test.go +++ b/pkg/commands/pull_request_test.go @@ -65,8 +65,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page&t=1"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page&t=1"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -84,8 +84,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events&t=1"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/events&t=1"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -103,8 +103,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@github.com:peter/calculator.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://github.com/peter/calculator/compare/feature/sum-operation?expand=1"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://github.com/peter/calculator/compare/feature/sum-operation?expand=1"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -123,8 +123,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@bitbucket.org:johndoe/social_network.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar&dest=feature/profile-page&t=1"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/profile-page/avatar&dest=feature/profile-page&t=1"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -143,8 +143,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "https://my_username@bitbucket.org/johndoe/social_network.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events&dest=feature/events&t=1"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://bitbucket.org/johndoe/social_network/pull-requests/new?source=feature/remote-events&dest=feature/events&t=1"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -163,8 +163,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@github.com:peter/calculator.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://github.com/peter/calculator/compare/feature/operations...feature/sum-operation?expand=1"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -182,8 +182,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -201,8 +201,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/ui"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -221,8 +221,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"`}) return secureexec.Command("echo") }, test: func(url string, err error) { @@ -241,8 +241,8 @@ func TestCreatePullRequest(t *testing.T) { return secureexec.Command("echo", "git@gitlab.com:peter/calculator.git") } - assert.Equal(t, cmd, "open") - assert.Equal(t, args, []string{"https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"}) + assert.Equal(t, cmd, "bash") + assert.Equal(t, args, []string{"-c", `open "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature/commit-ui&merge_request[target_branch]=epic/ui"`}) return secureexec.Command("echo") }, test: func(url string, err error) { |