| 22 | func (e UnthrottledChanTask) Throttled() bool { return false } |
| 23 | |
| 24 | func TestLoggerLogsTasks(t *testing.T) { |
| 25 | var buf bytes.Buffer |
| 26 | |
| 27 | task := make(chan *Update) |
| 28 | go func() { |
| 29 | task <- &Update{"first", time.Now(), false} |
| 30 | task <- &Update{"second", time.Now(), false} |
| 31 | close(task) |
| 32 | }() |
| 33 | |
| 34 | l := NewLogger(&buf, ForceProgress(true)) |
| 35 | l.throttle = 0 |
| 36 | l.widthFn = func() int { return 0 } |
| 37 | l.Enqueue(ChanTask(task)) |
| 38 | l.Close() |
| 39 | |
| 40 | assert.Equal(t, "first\rsecond\rsecond, done.\n", buf.String()) |
| 41 | } |
| 42 | |
| 43 | func TestLoggerLogsSuppressesProgress(t *testing.T) { |
| 44 | var buf bytes.Buffer |