(t *testing.T)
| 344 | } |
| 345 | |
| 346 | func TestFieldsMapPnt(t *testing.T) { |
| 347 | out := &bytes.Buffer{} |
| 348 | log := New(out) |
| 349 | log.Log().Fields(map[string]interface{}{ |
| 350 | "string": new(string), |
| 351 | "bool": new(bool), |
| 352 | "int": new(int), |
| 353 | "int8": new(int8), |
| 354 | "int16": new(int16), |
| 355 | "int32": new(int32), |
| 356 | "int64": new(int64), |
| 357 | "uint": new(uint), |
| 358 | "uint8": new(uint8), |
| 359 | "uint16": new(uint16), |
| 360 | "uint32": new(uint32), |
| 361 | "uint64": new(uint64), |
| 362 | "float32": new(float32), |
| 363 | "float64": new(float64), |
| 364 | "dur": new(time.Duration), |
| 365 | "time": new(time.Time), |
| 366 | }).Msg("") |
| 367 | if got, want := decodeIfBinaryToString(out.Bytes()), `{"bool":false,"dur":0,"float32":0,"float64":0,"int":0,"int16":0,"int32":0,"int64":0,"int8":0,"string":"","time":"0001-01-01T00:00:00Z","uint":0,"uint16":0,"uint32":0,"uint64":0,"uint8":0}`+"\n"; got != want { |
| 368 | t.Errorf("invalid log output:\ngot: %v\nwant: %v", got, want) |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | func TestFieldsMapNilPnt(t *testing.T) { |
| 373 | var ( |