refactor: implement mocking functions and tests
This commit is contained in:
parent
339dba4e13
commit
f8ef2ef2d5
21 changed files with 398 additions and 90 deletions
|
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
type HomebrewManager struct{}
|
||||
|
|
@ -23,7 +22,7 @@ func (h *HomebrewManager) Name() string {
|
|||
}
|
||||
|
||||
func (h *HomebrewManager) InstallManager() error {
|
||||
if _, err := exec.LookPath("brew"); err == nil {
|
||||
if _, err := execLookPath("brew"); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -39,6 +38,6 @@ func installHomebrew() error {
|
|||
}
|
||||
|
||||
func (h *HomebrewManager) InstallPackage(pkg string) error {
|
||||
cmd := exec.Command("brew", "install", pkg)
|
||||
cmd := execCommand("brew", "install", pkg)
|
||||
return cmd.Run()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue