aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/command_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/command_test.go')
-rw-r--r--modules/git/command_test.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/modules/git/command_test.go b/modules/git/command_test.go
index c965ea230d..52d25c9c74 100644
--- a/modules/git/command_test.go
+++ b/modules/git/command_test.go
@@ -27,15 +27,13 @@ func TestRunWithContextStd(t *testing.T) {
assert.Empty(t, stdout)
}
- assert.Panics(t, func() {
- cmd = NewCommand(context.Background())
- cmd.AddDynamicArguments("-test")
- })
-
- assert.Panics(t, func() {
- cmd = NewCommand(context.Background())
- cmd.AddDynamicArguments("--test")
- })
+ cmd = NewCommand(context.Background())
+ cmd.AddDynamicArguments("-test")
+ assert.ErrorIs(t, cmd.Run(&RunOpts{}), ErrBrokenCommand)
+
+ cmd = NewCommand(context.Background())
+ cmd.AddDynamicArguments("--test")
+ assert.ErrorIs(t, cmd.Run(&RunOpts{}), ErrBrokenCommand)
subCmd := "version"
cmd = NewCommand(context.Background()).AddDynamicArguments(subCmd) // for test purpose only, the sub-command should never be dynamic for production