Documentation
¶
Index ¶
- Variables
- func BeEmpty(actual interface{}, expected ...interface{}) error
- func BeFalse(actual interface{}, expected ...interface{}) error
- func BeIn(actual interface{}, expected ...interface{}) error
- func BeNil(actual interface{}, expected ...interface{}) error
- func BeTrue(actual interface{}, expected ...interface{}) error
- func Contain(actual interface{}, expected ...interface{}) error
- func EndWith(actual interface{}, expected ...interface{}) error
- func Equal(actual interface{}, EXPECTED ...interface{}) error
- func HaveLength(actual interface{}, expected ...interface{}) error
- func Panic(actual interface{}, expected ...interface{}) (err error)
- func StartWith(actual interface{}, expected ...interface{}) error
- func WrapError(actual interface{}, expected ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrExpectedCountInvalid = errors.New("expected count invalid") ErrTypeMismatch = errors.New("type mismatch") ErrKindMismatch = errors.New("kind mismatch") ErrAssertionFailure = errors.New("assertion failure") )
var NOT negated // TODO: NOT or Not?
NOT (a singleton) constrains all negated assertions to their own namespace.
Functions ¶
func BeEmpty ¶
func BeEmpty(actual interface{}, expected ...interface{}) error
BeEmpty uses reflection to verify that len(actual) == 0.
func BeFalse ¶
func BeFalse(actual interface{}, expected ...interface{}) error
BeFalse verifies that actual is the boolean false value.
func BeIn ¶ added in v0.8.0
func BeIn(actual interface{}, expected ...interface{}) error
BeIn determines whether actual is a member of expected[0]. It defers to Contain.
func BeNil ¶
func BeNil(actual interface{}, expected ...interface{}) error
BeNil verifies that actual is the nil value.
func BeTrue ¶
func BeTrue(actual interface{}, expected ...interface{}) error
BeTrue verifies that actual is the boolean true value.
func Contain ¶ added in v0.7.0
func Contain(actual interface{}, expected ...interface{}) error
Contain determines whether actual contains expected[0]. The actual value may be a map, array, slice, or string:
- In the case of maps the expected value is assumed to be a map key.
- In the case of slices and arrays the expected value is assumed to be a member.
- In the case of strings the expected value may be a rune or substring.
func EndWith ¶ added in v0.8.0
func EndWith(actual interface{}, expected ...interface{}) error
EndWith verifies that actual ends with expected[0]. The actual value may be an array, slice, or string.
func Equal ¶
func Equal(actual interface{}, EXPECTED ...interface{}) error
Equal verifies that the actual value is equal to the expected value. It uses reflect.DeepEqual in most cases.
func HaveLength ¶ added in v0.4.0
func HaveLength(actual interface{}, expected ...interface{}) error
HaveLength uses reflection to verify that len(actual) == 0.
func Panic ¶ added in v0.5.0
func Panic(actual interface{}, expected ...interface{}) (err error)
Panic invokes the func() provided as actual and recovers from any panic. It returns an error if actual() does not result in a panic.
Types ¶
This section is empty.