(t *testing.T)
| 35 | ) |
| 36 | |
| 37 | func TestTestLogger(t *testing.T) { |
| 38 | ts := newTestLogSpy(t) |
| 39 | defer ts.AssertPassed() |
| 40 | |
| 41 | log := NewLogger(ts) |
| 42 | |
| 43 | log.Info("received work order") |
| 44 | log.Debug("starting work") |
| 45 | log.Warn("work may fail") |
| 46 | log.Error("work failed", zap.Error(errors.New("great sadness"))) |
| 47 | |
| 48 | assert.Panics(t, func() { |
| 49 | log.Panic("failed to do work") |
| 50 | }, "log.Panic should panic") |
| 51 | |
| 52 | ts.AssertMessages( |
| 53 | "INFO received work order", |
| 54 | "DEBUG starting work", |
| 55 | "WARN work may fail", |
| 56 | `ERROR work failed {"error": "great sadness"}`, |
| 57 | "PANIC failed to do work", |
| 58 | ) |
| 59 | } |
| 60 | |
| 61 | func TestTestLoggerSupportsLevels(t *testing.T) { |
| 62 | ts := newTestLogSpy(t) |
nothing calls this directly
no test coverage detected