(t *testing.T)
| 212 | } |
| 213 | |
| 214 | func TestWithReset(t *testing.T) { |
| 215 | out := &bytes.Buffer{} |
| 216 | ctx := New(out).With(). |
| 217 | Str("string", "foo"). |
| 218 | Stringer("stringer", net.IP{127, 0, 0, 1}). |
| 219 | Stringer("stringer_nil", nil). |
| 220 | Reset(). |
| 221 | Bytes("bytes", []byte("bar")). |
| 222 | Hex("hex", []byte{0x12, 0xef}). |
| 223 | Uint64("uint64", 10). |
| 224 | Float64("float64", 12.30303). |
| 225 | Stack(). |
| 226 | Ctx(context.Background()) |
| 227 | log := ctx.Logger() |
| 228 | log.Log().Msg("") |
| 229 | if got, want := decodeIfBinaryToString(out.Bytes()), `{"bytes":"bar","hex":"12ef","uint64":10,"float64":12.30303}`+"\n"; got != want { |
| 230 | t.Errorf("invalid log output:\ngot: %v\nwant: %v", got, want) |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | func TestFieldsMap(t *testing.T) { |
| 235 | out := &bytes.Buffer{} |
nothing calls this directly
no test coverage detected