Documentation ¶
Overview ¶
Package assert provides utility functions for automated testing of Go packages. It extends the testing package of the Go standard library with some handy functions.
Index ¶
- func Equal(f Fataler, actual, expected interface{})
- func Err(f Fataler, actual, expected error)
- func ErrMsg(f Fataler, err error, msg string)
- func ErrMsgMatch(f Fataler, err error, msgRegexp string)
- func False(f Fataler, condition bool)
- func Len(f Fataler, value interface{}, expectedLen int)
- func Nil(f Fataler, value interface{})
- func NotEqual(f Fataler, actual, expected interface{})
- func NotNil(f Fataler, value interface{})
- func Panic(f Fataler, fn interface{}, args ...interface{})
- func True(f Fataler, condition bool)
- type Fataler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
func Equal(f Fataler, actual, expected interface{})
Equal asserts that the actual value equals the expected value. This function also compares the elements of arrays, slices, maps, and struct fields.
func ErrMsgMatch ¶
ErrMsgMatch asserts that the message of the given error matches the given regular expression.
func Len ¶
Len asserts that the length of an array, a channel, a map, a slice, or a string equals the expected length. It panics if another type is passed.
func NotEqual ¶
func NotEqual(f Fataler, actual, expected interface{})
NotEqual asserts that the actual value is not equal to the expected value. This functions also compares the elements of arrays, slices, maps, and struct fields.
func NotNil ¶
func NotNil(f Fataler, value interface{})
NotNil asserts that the given value is not nil.