(rt http.RoundTripper, prompter prompter.Prompter, isTTY bool, cli string)
| 167 | } |
| 168 | |
| 169 | func runCommand(rt http.RoundTripper, prompter prompter.Prompter, isTTY bool, cli string) (*test.CmdOut, error) { |
| 170 | ios, _, stdout, stderr := iostreams.Test() |
| 171 | ios.SetStdoutTTY(isTTY) |
| 172 | ios.SetStdinTTY(isTTY) |
| 173 | ios.SetStderrTTY(isTTY) |
| 174 | |
| 175 | factory := &cmdutil.Factory{ |
| 176 | IOStreams: ios, |
| 177 | HttpClient: func() (*http.Client, error) { |
| 178 | return &http.Client{Transport: rt}, nil |
| 179 | }, |
| 180 | Config: func() (gh.Config, error) { |
| 181 | return config.NewBlankConfig(), nil |
| 182 | }, |
| 183 | Prompter: prompter, |
| 184 | } |
| 185 | |
| 186 | cmd := NewCmdReview(factory, nil) |
| 187 | |
| 188 | argv, err := shlex.Split(cli) |
| 189 | if err != nil { |
| 190 | return nil, err |
| 191 | } |
| 192 | cmd.SetArgs(argv) |
| 193 | |
| 194 | cmd.SetIn(&bytes.Buffer{}) |
| 195 | cmd.SetOut(io.Discard) |
| 196 | cmd.SetErr(io.Discard) |
| 197 | |
| 198 | _, err = cmd.ExecuteC() |
| 199 | return &test.CmdOut{ |
| 200 | OutBuf: stdout, |
| 201 | ErrBuf: stderr, |
| 202 | }, err |
| 203 | } |
| 204 | |
| 205 | func TestPRReview(t *testing.T) { |
| 206 | tests := []struct { |
no test coverage detected