Skip to content

Commit

Permalink
Merge pull request #31 from anfernee/fake-exec
Browse files Browse the repository at this point in the history
FakeExec implements CommendContext in exec.Exec
  • Loading branch information
apelisse authored Dec 19, 2017
2 parents 66423a0 + 625c80a commit 0ab3217
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions exec/testing/fake_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package testingexec

import (
"context"
"fmt"
"io"

Expand All @@ -30,6 +31,8 @@ type FakeExec struct {
LookPathFunc func(string) (string, error)
}

var _ exec.Interface = &FakeExec{}

type FakeCommandAction func(cmd string, args ...string) exec.Cmd

func (fake *FakeExec) Command(cmd string, args ...string) exec.Cmd {
Expand All @@ -41,6 +44,10 @@ func (fake *FakeExec) Command(cmd string, args ...string) exec.Cmd {
return fake.CommandScript[i](cmd, args...)
}

func (fake *FakeExec) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd {
return fake.Command(cmd, args...)
}

func (fake *FakeExec) LookPath(file string) (string, error) {
return fake.LookPathFunc(file)
}
Expand Down

0 comments on commit 0ab3217

Please sign in to comment.