Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 16, 2023
Merged

Conversation

DPJacques
Copy link
Collaborator

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.

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.
@DPJacques DPJacques merged commit 44a3d47 into master Jul 16, 2023
8 checks passed
@DPJacques DPJacques deleted the panic branch July 16, 2023 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant