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

Function runCloneCommand

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

Source from the content-addressed store, hash-verified

112}
113
114func runCloneCommand(httpClient *http.Client, cli string) (*test.CmdOut, error) {
115 ios, stdin, stdout, stderr := iostreams.Test()
116 fac := &cmdutil.Factory{
117 IOStreams: ios,
118 HttpClient: func() (*http.Client, error) {
119 return httpClient, nil
120 },
121 Config: func() (gh.Config, error) {
122 return config.NewBlankConfig(), nil
123 },
124 GitClient: &git.Client{
125 GhPath: "some/path/gh",
126 GitPath: "some/path/git",
127 },
128 }
129
130 cmd := NewCmdClone(fac, nil)
131
132 argv, err := shlex.Split(cli)
133 cmd.SetArgs(argv)
134
135 cmd.SetIn(stdin)
136 cmd.SetOut(stderr)
137 cmd.SetErr(stderr)
138
139 if err != nil {
140 panic(err)
141 }
142
143 _, err = cmd.ExecuteC()
144
145 if err != nil {
146 return nil, err
147 }
148
149 return &test.CmdOut{OutBuf: stdout, ErrBuf: stderr}, nil
150}
151
152func Test_RepoClone(t *testing.T) {
153 tests := []struct {

Calls 3

TestFunction · 0.92
NewBlankConfigFunction · 0.92
NewCmdCloneFunction · 0.70

Tested by

no test coverage detected