Documentation ¶
Overview ¶
Package assert contains functions for making assertions in unit tests
Index ¶
- func Contains(t TestingT, actual, contains string)
- func DeepEqual(t TestingT, actual, expected interface{})
- func Equal(t TestingT, actual, expected interface{})
- func EqualNormalizedString(t TestingT, transformFun func(rune) rune, actual, expected string)
- func EqualStringSlice(t TestingT, actual, expected []string)
- func Error(t TestingT, err error, contains string)
- func NilError(t TestingT, err error)
- func NotNil(t TestingT, obj interface{})
- func RemoveSpace(r rune) rune
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepEqual ¶
func DeepEqual(t TestingT, actual, expected interface{})
DeepEqual compare the actual value to the expected value and fails the test if they are not "deeply equal".
func Equal ¶
func Equal(t TestingT, actual, expected interface{})
Equal compare the actual value to the expected value and fails the test if they are not equal.
func EqualNormalizedString ¶
EqualNormalizedString compare the actual value to the expected value after applying the specified transform function. It fails the test if these two transformed string are not equal. For example `EqualNormalizedString(t, RemoveSpace, "foo\n", "foo")` wouldn't fail the test as spaces (and thus '\n') are removed before comparing the string.
func EqualStringSlice ¶
EqualStringSlice compares two slices and fails the test if they do not contain the same items.
func Error ¶
Error asserts that error is not nil, and contains the expected text, otherwise it fails the test.
func RemoveSpace ¶
RemoveSpace returns -1 if the specified runes is considered as a space (unicode) and the rune itself otherwise.