(t *testing.T)
| 401 | } |
| 402 | |
| 403 | func TestCmdShowTaskDueDate(t *testing.T) { |
| 404 | root, db := showListEditDB(t) |
| 405 | insertTask(t, db, "urgent", "Urgent", "in-progress", "high", filepath.Join(root, "x"), nil) |
| 406 | // Set due date to 2 days from now. |
| 407 | due := time.Now().AddDate(0, 0, 2).Format("2006-01-02") |
| 408 | if _, err := db.Exec(`UPDATE tasks SET due_date = ? WHERE slug = ?`, due, "urgent"); err != nil { |
| 409 | t.Fatal(err) |
| 410 | } |
| 411 | out := captureStdout(t, func() { |
| 412 | if rc := cmdShow([]string{"task", "urgent"}); rc != 0 { |
| 413 | t.Errorf("rc=%d", rc) |
| 414 | } |
| 415 | }) |
| 416 | if !strings.Contains(out, "due:") { |
| 417 | t.Errorf("missing due: line; out=%q", out) |
| 418 | } |
| 419 | if !strings.Contains(out, due) { |
| 420 | t.Errorf("missing due date value; out=%q", out) |
| 421 | } |
| 422 | if !strings.Contains(out, "(in 2 days)") { |
| 423 | t.Errorf("missing due date info; out=%q", out) |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | func TestCmdShowTaskOverdue(t *testing.T) { |
| 428 | root, db := showListEditDB(t) |
nothing calls this directly
no test coverage detected