(httpClient *http.Client, cli string)
| 17 | ) |
| 18 | |
| 19 | func runCloneCommand(httpClient *http.Client, cli string) (*test.CmdOut, error) { |
| 20 | ios, stdin, stdout, stderr := iostreams.Test() |
| 21 | fac := &cmdutil.Factory{ |
| 22 | IOStreams: ios, |
| 23 | HttpClient: func() (*http.Client, error) { |
| 24 | return httpClient, nil |
| 25 | }, |
| 26 | Config: func() (gh.Config, error) { |
| 27 | return config.NewBlankConfig(), nil |
| 28 | }, |
| 29 | GitClient: &git.Client{ |
| 30 | GhPath: "some/path/gh", |
| 31 | GitPath: "some/path/git", |
| 32 | }, |
| 33 | } |
| 34 | |
| 35 | cmd := NewCmdClone(fac, nil) |
| 36 | |
| 37 | argv, err := shlex.Split(cli) |
| 38 | cmd.SetArgs(argv) |
| 39 | |
| 40 | cmd.SetIn(stdin) |
| 41 | cmd.SetOut(stderr) |
| 42 | cmd.SetErr(stderr) |
| 43 | |
| 44 | if err != nil { |
| 45 | panic(err) |
| 46 | } |
| 47 | |
| 48 | _, err = cmd.ExecuteC() |
| 49 | |
| 50 | if err != nil { |
| 51 | return nil, err |
| 52 | } |
| 53 | |
| 54 | return &test.CmdOut{OutBuf: stdout, ErrBuf: stderr}, nil |
| 55 | } |
| 56 | |
| 57 | func Test_GistClone(t *testing.T) { |
| 58 | tests := []struct { |
no test coverage detected