(rt http.RoundTripper, isTTY bool, cli string)
| 346 | } |
| 347 | |
| 348 | func runCommand(rt http.RoundTripper, isTTY bool, cli string) (*test.CmdOut, error) { |
| 349 | ios, _, stdout, stderr := iostreams.Test() |
| 350 | ios.SetStdoutTTY(isTTY) |
| 351 | ios.SetStdinTTY(isTTY) |
| 352 | ios.SetStderrTTY(isTTY) |
| 353 | |
| 354 | factory := &cmdutil.Factory{ |
| 355 | IOStreams: ios, |
| 356 | HttpClient: func() (*http.Client, error) { |
| 357 | return &http.Client{Transport: rt}, nil |
| 358 | }, |
| 359 | Config: func() (gh.Config, error) { |
| 360 | return config.NewBlankConfig(), nil |
| 361 | }, |
| 362 | } |
| 363 | |
| 364 | cmd := NewCmdList(factory, nil) |
| 365 | |
| 366 | argv, err := shlex.Split(cli) |
| 367 | if err != nil { |
| 368 | return nil, err |
| 369 | } |
| 370 | cmd.SetArgs(argv) |
| 371 | |
| 372 | cmd.SetIn(&bytes.Buffer{}) |
| 373 | cmd.SetOut(io.Discard) |
| 374 | cmd.SetErr(io.Discard) |
| 375 | |
| 376 | _, err = cmd.ExecuteC() |
| 377 | return &test.CmdOut{ |
| 378 | OutBuf: stdout, |
| 379 | ErrBuf: stderr, |
| 380 | }, err |
| 381 | } |
| 382 | |
| 383 | func TestRepoList_nontty(t *testing.T) { |
| 384 | ios, _, stdout, stderr := iostreams.Test() |
no test coverage detected
searching dependent graphs…