captureStatusNoArgsOutput runs status with no arguments and captures stdout.
(t *testing.T)
| 535 | |
| 536 | // captureStatusNoArgsOutput runs status with no arguments and captures stdout. |
| 537 | func captureStatusNoArgsOutput(t *testing.T) (string, error) { |
| 538 | t.Helper() |
| 539 | |
| 540 | oldStdout := os.Stdout |
| 541 | r, w, _ := os.Pipe() |
| 542 | os.Stdout = w |
| 543 | |
| 544 | err := runStatus(statusCmd, []string{}) |
| 545 | |
| 546 | w.Close() |
| 547 | os.Stdout = oldStdout |
| 548 | |
| 549 | var buf bytes.Buffer |
| 550 | buf.ReadFrom(r) |
| 551 | return buf.String(), err |
| 552 | } |
| 553 | |
| 554 | func captureStatusNoArgsOutputWithStderr(t *testing.T) (string, string, error) { |
| 555 | t.Helper() |
no test coverage detected