Documentation
¶
Overview ¶
Package clocktest bridges clock capabilities to testing/synctest and manual advancement. Start with SystemBubble when the whole test can use a synctest bubble, or Advance when explicit manual-clock progress is required.
Helpers do not install a global clock or manage a manual clock's lifetime. Callers own manual clock release and callback cooperation. The package uses Go's testing facilities without external infrastructure or cgo.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Advance ¶
Advance advances a manual clock, waits for all synchronously triggered work, and fails the current test if either phase reports an error. The clock must be non-nil. The wait uses t.Context(), but cancellation cannot interrupt an Advance that is itself blocked by an uncooperative callback.
func SystemBubble ¶
SystemBubble runs test in a testing/synctest bubble with a System clock. Prefer this helper when the complete unit under test can live inside one bubble. Use dependency-injected manual clocks for explicit business timestamps, wall jumps, and cross-package clock contracts.
func Wait ¶
Wait checks ctx and then waits for every other goroutine in the current synctest bubble to become durably blocked. It must be called from a bubble unless ctx is already canceled. A nil context panics. Cancellation is checked before and after the wait; it does not interrupt synctest.Wait.
Types ¶
This section is empty.