Documentation
¶
Index ¶
- func FuncReturning(funcType reflect.Type, results ...interface{}) reflect.Value
- type Stubs
- func (s *Stubs) Reset()
- func (s *Stubs) ResetSingle(varToStub interface{})
- func (s *Stubs) SetEnv(k, v string) *Stubs
- func (s *Stubs) Stub(varToStub interface{}, stubVal interface{}) *Stubs
- func (s *Stubs) StubFunc(funcVarToStub interface{}, stubVal ...interface{}) *Stubs
- func (s *Stubs) UnsetEnv(k string) *Stubs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Stubs ¶
type Stubs struct {
// contains filtered or unexported fields
}
Stubs represents a set of stubbed variables that can be reset.
func Stub ¶
func Stub(varToStub interface{}, stubVal interface{}) *Stubs
Stub replaces the value stored at varToStub with stubVal. varToStub must be a pointer to the variable. stubVal should have a type that is assignable to the variable.
func StubFunc ¶
func StubFunc(funcVarToStub interface{}, stubVal ...interface{}) *Stubs
StubFunc replaces a function variable with a function that returns stubVal. funcVarToStub must be a pointer to a function variable. If the function returns multiple values, then multiple values should be passed to stubFunc. The values must match be assignable to the return values' types.
func (*Stubs) Reset ¶
func (s *Stubs) Reset()
Reset resets all stubbed variables back to their original values.
func (*Stubs) ResetSingle ¶
func (s *Stubs) ResetSingle(varToStub interface{})
ResetSingle resets a single stubbed variable back to its original value.
func (*Stubs) Stub ¶
Stub replaces the value stored at varToStub with stubVal. varToStub must be a pointer to the variable. stubVal should have a type that is assignable to the variable.
func (*Stubs) StubFunc ¶
StubFunc replaces a function variable with a function that returns stubVal. funcVarToStub must be a pointer to a function variable. If the function returns multiple values, then multiple values should be passed to stubFunc. The values must match be assignable to the return values' types.