Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithTempDir ¶
Types ¶
type CallCounter ¶
type CallCounter struct {
// contains filtered or unexported fields
}
CallCounter provides a mechanism for one goroutine to increment a counter, usually once per some method call, and for other goroutines to block until the counter reaches some expected value.
func NewCallCounter ¶
func NewCallCounter() *CallCounter
func (*CallCounter) Incr ¶
func (c *CallCounter) Incr()
Incr increments the call counter and unblocks any waiters whose expected call counter is now met. It is safe to this method on the zero value since both test and non-test code is expected to call this. This method is safe to be used from multiple goroutines.
func (*CallCounter) Wait ¶
func (c *CallCounter) Wait(expected int)
Wait blocks the calling goroutine until the callCounter reaches atleast expected number of calls. Since this method is only expected to be called by test code, it will panic if called on the zero value as way to alert the user that they forgot to initialize the callCounter. This method is safe to be called from multiple goroutines.