pkg/util/exec: allow mocking of LookPath

This commit is contained in:
Mikaël Cluseau
2015-09-11 19:32:35 +11:00
parent 99a1cfa8ff
commit 1ab520a59b
5 changed files with 29 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package exec
import (
osexec "os/exec"
"testing"
)
@@ -81,3 +82,13 @@ func TestExecutorWithArgs(t *testing.T) {
t.Errorf("unexpected output: %q", string(out))
}
}
func TestLookPath(t *testing.T) {
ex := New()
shExpected, _ := osexec.LookPath("sh")
sh, _ := ex.LookPath("sh")
if sh != shExpected {
t.Errorf("unexpected result for LookPath: got %s, expected %s", sh, shExpected)
}
}