MCPcopy Create free account
hub / github.com/driangle/taskmd / TestPrintIssue_WithoutTaskID

Function TestPrintIssue_WithoutTaskID

apps/cli/internal/cli/validate_test.go:283–309  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

281}
282
283func TestPrintIssue_WithoutTaskID(t *testing.T) {
284 issue := validator.ValidationIssue{
285 Level: validator.LevelError,
286 Message: "global error",
287 }
288
289 oldStdout := os.Stdout
290 r, w, _ := os.Pipe()
291 os.Stdout = w
292
293 printIssue(issue, getRenderer())
294
295 w.Close()
296 os.Stdout = oldStdout
297
298 var buf bytes.Buffer
299 buf.ReadFrom(r)
300 output := buf.String()
301
302 if !strings.Contains(output, "global error") {
303 t.Errorf("expected message in output, got:\n%s", output)
304 }
305 // Should not contain bracket prefix for task ID
306 if strings.Contains(output, "[") && strings.Contains(output, "]") {
307 t.Errorf("expected no [ID] prefix, got:\n%s", output)
308 }
309}
310
311func TestPrintIssue_WithFilePath(t *testing.T) {
312 issue := validator.ValidationIssue{

Callers

nothing calls this directly

Calls 2

printIssueFunction · 0.85
getRendererFunction · 0.85

Tested by

no test coverage detected