Documentation ¶
Overview ¶
Package expectation provides expectation (assertion) helpers.
Index ¶
- func Contains(actual, expected interface{}, name string, skip int) error
- func Equal(actual, expected interface{}, name string, skip int) error
- func HasPrefix(actual, expected interface{}, name string, skip int) error
- func HasSuffix(actual, expected interface{}, name string, skip int) error
- func IsType(actual, expected interface{}, name string, skip int) error
- func NotEqual(actual, expected interface{}, name string, skip int) error
- func Panic(actual, expected interface{}, name string, skip int) (ret error)
- func SetOutput(w io.Writer)
- type Actual
- func (a *Actual) Contains(expected interface{})
- func (a *Actual) Equal(expected interface{})
- func (a *Actual) HasPrefix(expected interface{})
- func (a *Actual) HasSuffix(expected interface{})
- func (a *Actual) IsType(expected interface{})
- func (a *Actual) NotEqual(expected interface{})
- func (a *Actual) Panic()
- func (a *Actual) To(check Checker, expected interface{})
- type Checker
- type ExpectFunc
- type FailFunc
- type T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Actual ¶
type Actual struct {
// contains filtered or unexported fields
}
Actual provides checking methods for an actual value in an expectation.
func (*Actual) Contains ¶
func (a *Actual) Contains(expected interface{})
Contains is the fluent method for checker Contains.
func (*Actual) Equal ¶
func (a *Actual) Equal(expected interface{})
Equal is the fluent method for checker Equal.
func (*Actual) HasPrefix ¶
func (a *Actual) HasPrefix(expected interface{})
HasPrefix is the fluent method for checker HasPrefix.
func (*Actual) HasSuffix ¶
func (a *Actual) HasSuffix(expected interface{})
HasSuffix is the fluent method for checker HasSuffix.
func (*Actual) IsType ¶
func (a *Actual) IsType(expected interface{})
IsType is the fluent method for checker IsType.
type Checker ¶
Checker is the type of function that checks between actual and expected value then returns an Error if the expectation fails.
type ExpectFunc ¶
type ExpectFunc func(actual ...interface{}) *Actual
ExpectFunc is the type of function that returns an Actual object given an actual value or a name and an actual value.
func Alias ¶
func Alias(fail FailFunc, skip ...int) ExpectFunc
Alias registers a fail function and returns an ExpectFunc. The optional skip parameter is used to skip extra function calls in the stack trace in case the ExpectFunc is further wrapped by another function.