(t testing.TB, field Field)
| 41 | } |
| 42 | |
| 43 | func assertCanBeReused(t testing.TB, field Field) { |
| 44 | var wg sync.WaitGroup |
| 45 | |
| 46 | for i := 0; i < 100; i++ { |
| 47 | enc := zapcore.NewMapObjectEncoder() |
| 48 | |
| 49 | // Ensure using the field in multiple encoders in separate goroutines |
| 50 | // does not cause any races or panics. |
| 51 | wg.Add(1) |
| 52 | go func() { |
| 53 | defer wg.Done() |
| 54 | assert.NotPanics(t, func() { |
| 55 | field.AddTo(enc) |
| 56 | }, "Reusing a field should not cause issues") |
| 57 | }() |
| 58 | } |
| 59 | |
| 60 | wg.Wait() |
| 61 | } |
| 62 | |
| 63 | func TestFieldConstructors(t *testing.T) { |
| 64 | // Interface types. |
no test coverage detected