Documentation ¶
Overview ¶
Package ensure provides utilities for testing to ensure the given conditions are met and Fatal if they aren't satisified.
The various functions here show a useful error message automatically including identifying source location. They additionally support arbitary arguments which will be printed using the spew library.
Index ¶
- func DeepEqual(t Fataler, actual, expected interface{}, a ...interface{})
- func DisorderedSubset(t Fataler, a, s interface{}, extra ...interface{})
- func Err(t Fataler, err error, re *regexp.Regexp, a ...interface{})
- func False(t Fataler, v bool, a ...interface{})
- func Nil(t Fataler, v interface{}, a ...interface{})
- func NotDeepEqual(t Fataler, actual, expected interface{}, a ...interface{})
- func NotNil(t Fataler, v interface{}, a ...interface{})
- func PanicDeepEqual(t Fataler, expected interface{}, a ...interface{})
- func SameElements(t Fataler, actual, expected interface{}, extra ...interface{})
- func StringContains(t Fataler, s, substr string, a ...interface{})
- func StringDoesNotContain(t Fataler, s, substr string, a ...interface{})
- func Subset(t Fataler, actual, subset interface{}, a ...interface{})
- func True(t Fataler, v bool, a ...interface{})
- type Fataler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepEqual ¶
func DeepEqual(t Fataler, actual, expected interface{}, a ...interface{})
DeepEqual ensures actual and expected are equal. It does so using reflect.DeepEqual.
func DisorderedSubset ¶
func DisorderedSubset(t Fataler, a, s interface{}, extra ...interface{})
DisorderedSubset attempts to find all the given subsets in the list of actuals. Does not allow one actual to match more than one subset, be warray of the possibility of insufficiently specific subsets.
func NotDeepEqual ¶
func NotDeepEqual(t Fataler, actual, expected interface{}, a ...interface{})
NotDeepEqual ensures actual and expected are not equal. It does so using reflect.DeepEqual.
func PanicDeepEqual ¶
func PanicDeepEqual(t Fataler, expected interface{}, a ...interface{})
PanicDeepEqual ensures a panic occurs and the recovered value is DeepEqual to the expected value.
func SameElements ¶
func SameElements(t Fataler, actual, expected interface{}, extra ...interface{})
SameElements ensures the two given slices contain the same elements, ignoring the order. It uses DeepEqual for element comparison.
func StringContains ¶
StringContains ensures string s contains the string substr.
func StringDoesNotContain ¶
StringDoesNotContain ensures string s does not contain the string substr.