MCPcopy
hub / github.com/uber-go/zap / TestMockClock_NewTicker_slowConsumer

Function TestMockClock_NewTicker_slowConsumer

internal/ztest/clock_test.go:59–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestMockClock_NewTicker_slowConsumer(t *testing.T) {
60 clock := NewMockClock()
61
62 ticker := clock.NewTicker(time.Microsecond)
63 defer ticker.Stop()
64
65 // Two ticks, only one consumed.
66 clock.Add(2 * time.Microsecond)
67 <-ticker.C
68
69 select {
70 case <-ticker.C:
71 t.Fatal("unexpected tick")
72 default:
73 // ok
74 }
75}
76
77func TestMockClock_Add_negative(t *testing.T) {
78 clock := NewMockClock()

Callers

nothing calls this directly

Calls 5

NewTickerMethod · 0.95
AddMethod · 0.95
NewMockClockFunction · 0.85
StopMethod · 0.80
FatalMethod · 0.45

Tested by

no test coverage detected