Skip to content

Commit

Permalink
Fix Execute() tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koddr committed Aug 21, 2023
1 parent 55f0f62 commit aaa4b53
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions internal/executor/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import "testing"

func TestExecCommand(t *testing.T) {
type args struct {
command string
options []string
silentMode bool
command string
options []string
}
tests := []struct {
name string
Expand All @@ -16,31 +15,24 @@ func TestExecCommand(t *testing.T) {
{
"successfully executing command",
args{
command: "echo",
options: []string{"ping"},
silentMode: false,
command: "echo",
options: []string{"ping"},
},
false,
},
{
"successfully executing command with silent mode",
args{
command: "echo",
options: []string{"ping"},
silentMode: true,
command: "echo",
options: []string{"ping"},
},
false,
},
{
"failed executing command",
args{},
true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := ExecCommand(tt.args.command, tt.args.options, tt.args.silentMode); (err != nil) != tt.wantErr {
t.Errorf("ExecCommand() error = %v, wantErr %v", err, tt.wantErr)
if err := Execute(tt.args.command, tt.args.options...); (err != nil) != tt.wantErr {
t.Errorf("Execute() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
Expand Down

0 comments on commit aaa4b53

Please sign in to comment.