utils_test.go 696 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package download
  2. import (
  3. "os/exec"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. "github.com/Jguer/yay/v10/pkg/settings/exe"
  7. )
  8. type testRunner struct {
  9. }
  10. func (t *testRunner) Capture(cmd *exec.Cmd, timeout int64) (stdout string, stderr string, err error) {
  11. return "", "", nil
  12. }
  13. func (t *testRunner) Show(cmd *exec.Cmd) error {
  14. return nil
  15. }
  16. type testGitBuilder struct {
  17. index int
  18. test *testing.T
  19. want string
  20. parentBuilder *exe.CmdBuilder
  21. }
  22. func (t *testGitBuilder) BuildGitCmd(dir string, extraArgs ...string) *exec.Cmd {
  23. cmd := t.parentBuilder.BuildGitCmd(dir, extraArgs...)
  24. assert.Equal(t.test, t.want, cmd.String())
  25. t.index += 1
  26. return cmd
  27. }