github.com/petergtz/pegomock@v2.9.1-0.20230424204322-eb0e044013df+incompatible/types.go (about)

     1  package pegomock
     2  
     3  type FailHandler func(message string, callerSkip ...int)
     4  
     5  type Mock interface {
     6  	SetFailHandler(FailHandler)
     7  	FailHandler() FailHandler
     8  }
     9  type Param interface{}
    10  type ReturnValue interface{}
    11  type ReturnValues []ReturnValue
    12  
    13  type Option interface{ Apply(Mock) }
    14  
    15  type OptionFunc func(mock Mock)
    16  
    17  func (f OptionFunc) Apply(mock Mock) { f(mock) }
    18  
    19  func WithFailHandler(fail FailHandler) Option {
    20  	return OptionFunc(func(mock Mock) { mock.SetFailHandler(fail) })
    21  }