jonboulle / clockwork

a fake clock for golang
Apache License 2.0
625 stars 57 forks source link

Make NewTicker panic if d<=0, like time.NewTicker. #70

Closed DPJacques closed 11 months ago

DPJacques commented 11 months ago

This more closely follows the standard library function behavior.

It is directly copied from the standard library: https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/time/tick.go;l=23-25

Although panicking is generally bad, it is preferable to mimic the standard library so users see the same behavior between clockwork and the golang standard library.

Without this, some tests can pass with a no op where a real time.Ticker implementation would crash.