(t *testing.T)
| 44 | } |
| 45 | |
| 46 | func TestCmdListTasksPrioritySort(t *testing.T) { |
| 47 | root, db := showListEditDB(t) |
| 48 | insertTask(t, db, "c-low", "c", "backlog", "low", filepath.Join(root, "x"), nil) |
| 49 | insertTask(t, db, "a-high", "a", "backlog", "high", filepath.Join(root, "x"), nil) |
| 50 | insertTask(t, db, "b-med", "b", "backlog", "medium", filepath.Join(root, "x"), nil) |
| 51 | |
| 52 | out := captureStdout(t, func() { |
| 53 | if rc := cmdList([]string{"tasks"}); rc != 0 { |
| 54 | t.Errorf("rc=%d", rc) |
| 55 | } |
| 56 | }) |
| 57 | ih := strings.Index(out, "a-high") |
| 58 | im := strings.Index(out, "b-med") |
| 59 | il := strings.Index(out, "c-low") |
| 60 | if ih < 0 || im < 0 || il < 0 { |
| 61 | t.Fatalf("missing rows; out=%q", out) |
| 62 | } |
| 63 | if !(ih < im && im < il) { |
| 64 | t.Errorf("priority order wrong: high=%d, med=%d, low=%d", ih, im, il) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestCmdListTasksStaleMarker(t *testing.T) { |
| 69 | root, db := showListEditDB(t) |
nothing calls this directly
no test coverage detected