(t *testing.T)
| 269 | } |
| 270 | |
| 271 | func TestFieldDoesNotClashWithCaller(t *testing.T) { |
| 272 | SetReportCaller(false) |
| 273 | formatter := &JSONFormatter{} |
| 274 | |
| 275 | b, err := formatter.Format(WithField("func", "howdy pardner")) |
| 276 | if err != nil { |
| 277 | t.Fatal("Unable to format entry: ", err) |
| 278 | } |
| 279 | |
| 280 | entry := make(map[string]interface{}) |
| 281 | err = json.Unmarshal(b, &entry) |
| 282 | if err != nil { |
| 283 | t.Fatal("Unable to unmarshal formatted entry: ", err) |
| 284 | } |
| 285 | |
| 286 | if entry["func"] != "howdy pardner" { |
| 287 | t.Fatal("func field replaced when ReportCaller=false") |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | func TestFieldClashWithCaller(t *testing.T) { |
| 292 | SetReportCaller(true) |
nothing calls this directly
no test coverage detected