(t *testing.T)
| 1280 | } |
| 1281 | |
| 1282 | func TestUpdateContextOnNopLogger(t *testing.T) { |
| 1283 | // Nop() creates a new disabled logger that is a different pointer than |
| 1284 | // the package-level disabledLogger. UpdateContext should still treat it |
| 1285 | // as disabled and skip the update function. See issue #643. |
| 1286 | log := Nop() |
| 1287 | |
| 1288 | called := false |
| 1289 | log.UpdateContext(func(c Context) Context { |
| 1290 | called = true |
| 1291 | return c.Str("foo", "bar") |
| 1292 | }) |
| 1293 | |
| 1294 | if called { |
| 1295 | t.Error("UpdateContext should not call update func on a Nop logger") |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | func TestUpdateContextOnZeroValueLogger(t *testing.T) { |
| 1300 | // A zero-value Logger has a nil writer and should be treated as |
nothing calls this directly
no test coverage detected