captureRunList runs runList and captures stdout.
(t *testing.T, args []string)
| 566 | |
| 567 | // captureRunList runs runList and captures stdout. |
| 568 | func captureRunList(t *testing.T, args []string) string { |
| 569 | t.Helper() |
| 570 | |
| 571 | oldStdout := os.Stdout |
| 572 | r, w, _ := os.Pipe() |
| 573 | os.Stdout = w |
| 574 | |
| 575 | err := runList(listCmd, args) |
| 576 | w.Close() |
| 577 | os.Stdout = oldStdout |
| 578 | |
| 579 | if err != nil { |
| 580 | t.Fatalf("runList failed: %v", err) |
| 581 | } |
| 582 | |
| 583 | var buf bytes.Buffer |
| 584 | buf.ReadFrom(r) |
| 585 | return buf.String() |
| 586 | } |
| 587 | |
| 588 | func TestListCommand_ScopeFilter(t *testing.T) { |
| 589 | tmpDir := createScopedListTaskFiles(t) |
no test coverage detected