MCPcopy Index your code
hub / github.com/cli/cli / runCloneCommand

Function runCloneCommand

pkg/cmd/gist/clone/clone_test.go:19–55  ·  view source on GitHub ↗
(httpClient *http.Client, cli string)

Source from the content-addressed store, hash-verified

17)
18
19func 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
57func Test_GistClone(t *testing.T) {
58 tests := []struct {

Callers 2

Test_GistCloneFunction · 0.70
Test_GistClone_flagErrorFunction · 0.70

Calls 3

TestFunction · 0.92
NewBlankConfigFunction · 0.92
NewCmdCloneFunction · 0.70

Tested by

no test coverage detected