(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestTaskLastRun(t *testing.T) { |
| 71 | tempXDGStateDir(t) |
| 72 | |
| 73 | task := &testTask{ |
| 74 | RunFunc: func(ctx context.Context) error { return nil }, |
| 75 | NeedsRunFunc: func(context.Context, RunInfo) bool { return true }, |
| 76 | } |
| 77 | err := Run(t.Context(), t.Name(), task) |
| 78 | if err != nil { |
| 79 | t.Error("got non-nil error on first run:", err) |
| 80 | } |
| 81 | |
| 82 | task.NeedsRunFunc = func(ctx context.Context, lastRun RunInfo) bool { |
| 83 | if lastRun.Time.IsZero() { |
| 84 | t.Error("got zero lastRun.Time on second run") |
| 85 | } |
| 86 | if lastRun.Version == "" { |
| 87 | t.Error("got empty lastRun.Version on second run") |
| 88 | } |
| 89 | if lastRun.Error != "" { |
| 90 | t.Errorf("got non-empty lastRun.Error on second run: %v", lastRun.Error) |
| 91 | } |
| 92 | return false |
| 93 | } |
| 94 | err = Run(t.Context(), t.Name(), task) |
| 95 | if err != nil { |
| 96 | t.Error("got non-nil error on second run:", err) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func TestTaskConfirmPromptAllow(t *testing.T) { |
| 101 | tempXDGStateDir(t) |
nothing calls this directly
no test coverage detected