(t *testing.T, query string)
| 85 | } |
| 86 | |
| 87 | func captureStatusOutput(t *testing.T, query string) string { |
| 88 | t.Helper() |
| 89 | |
| 90 | oldStdout := os.Stdout |
| 91 | r, w, _ := os.Pipe() |
| 92 | os.Stdout = w |
| 93 | |
| 94 | err := runStatus(statusCmd, []string{query}) |
| 95 | if err != nil { |
| 96 | w.Close() |
| 97 | os.Stdout = oldStdout |
| 98 | t.Fatalf("runStatus failed: %v", err) |
| 99 | } |
| 100 | |
| 101 | w.Close() |
| 102 | os.Stdout = oldStdout |
| 103 | |
| 104 | var buf bytes.Buffer |
| 105 | buf.ReadFrom(r) |
| 106 | return buf.String() |
| 107 | } |
| 108 | |
| 109 | func TestStatus_ExactMatchByID(t *testing.T) { |
| 110 | tmpDir := createStatusTestFiles(t) |
no test coverage detected