Documentation ¶
Index ¶
- Variables
- type Expect
- type Test
- type Val
- func (e Val) First() Val
- func (e Val) Last() Val
- func (e Val) Message() Val
- func (e Val) NotToBe(unExpected interface{}) Val
- func (e Val) ToBe(expected interface{}) Val
- func (e Val) ToBeAbout(expected, delta float64) Val
- func (e Val) ToBeType(t any) Val
- func (e Val) ToCount(c int) Val
- func (e Val) ToHavePrefix(prefix string) Val
- func (e Val) ToHaveSuffix(suffix string) Val
Constants ¶
This section is empty.
Variables ¶
var ( PlainOutput = output("plain") ColoredDiffOutput = output("coloredDiffOutput") )
var Default = &Expect{ Output: PlainOutput, }
Functions ¶
This section is empty.
Types ¶
type Expect ¶
type Expect struct {
Output output
}
type Test ¶
type Test interface { Fatalf(f string, i ...interface{}) Errorf(f string, i ...interface{}) Error(p ...interface{}) Helper() }
Test implements testing.T methods used by expect. Necessary to: - allow usage of testing.T and testing.B instances - for running tests
type Val ¶
type Val struct {
// contains filtered or unexported fields
}
Val to call expectations on.
func Error ¶ added in v0.3.0
Error wraps an error and provides expectations for this value. It delegates to the default instance `Default`.
func Value ¶
Value wraps a value and provides expectations for this value. It delegates to the default instance `Default`.
func (Val) Message ¶ added in v0.3.0
Message creates a new value from the given errors message. If the error is nil the message wil be the empty string.
func (Val) ToBeAbout ¶
ToBeAbout asserts that the number is in deltas range of expected value. Only works for numbers.
func (Val) ToCount ¶
ToCount asserts that the list/map/chan/string has c elements. Strings use the number of unicode chars.
func (Val) ToHavePrefix ¶
ToHavePrefix asserts that the string value starts with the provided prefix.
func (Val) ToHaveSuffix ¶
ToHaveSuffix asserts that the string value ends with the provided sufix.