MCPcopy
hub / github.com/rs/zerolog / TestAppendDurationInteger

Function TestAppendDurationInteger

internal/json/time_test.go:303–317  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

301 }
302}
303func TestAppendDurationInteger(t *testing.T) {
304 for _, tt := range internal.DurTestcases {
305 dur := tt.Duration
306 want := []byte{}
307 whole := int(dur) / int(time.Microsecond)
308 want = append(want, []byte(fmt.Sprintf("%v", whole))...)
309 got := enc.AppendDuration([]byte{}, dur, time.Microsecond, "", true, -1)
310 if !bytes.Equal(got, want) {
311 t.Errorf("AppendDuration(%v)=\ngot: %s\nwant: %s",
312 dur,
313 string(got),
314 string(want))
315 }
316 }
317}
318func TestAppendDurations(t *testing.T) {
319 array := make([]time.Duration, len(internal.DurTestcases))
320 want := make([]byte, 0)

Callers

nothing calls this directly

Calls 1

AppendDurationMethod · 0.65

Tested by

no test coverage detected