Documentation
¶
Index ¶
- func BeDeepZero(t assert.Test, value any, msg ...any)
- func BeEmpty[T any](t assert.Test, slice []T, msg ...any)
- func BeEmptyString[T ~string](t assert.Test, value T, msg ...any)
- func BeError(t assert.Test, err, targetErr error, msg ...any)
- func BeErrorContaining(t assert.Test, err error, value string, msg ...any)
- func BeErrorNotContaining(t assert.Test, err error, value string, msg ...any)
- func BeFalse(t assert.Test, value bool, msg ...any)
- func BeGreater[T assert.Ordered](t assert.Test, value, other T, msg ...any)
- func BeGreaterBytes(t assert.Test, value, other []byte, msg ...any)
- func BeGreaterOrEqual[T assert.Ordered](t assert.Test, value, other T, msg ...any)
- func BeGreaterOrEqualBytes(t assert.Test, itemA, itemB []byte, msg ...any)
- func BeInArray(t assert.Test, array, item any, msg ...any)
- func BeInRange[T assert.Ordered](t assert.Test, item, min, max T, msg ...any)
- func BeLesser[T assert.Ordered](t assert.Test, value, other T, msg ...any)
- func BeLesserBytes(t assert.Test, value, other []byte, msg ...any)
- func BeLesserOrEqual[T assert.Ordered](t assert.Test, value, other T, msg ...any)
- func BeLesserOrEqualBytes(t assert.Test, itemA, itemB []byte, msg ...any)
- func BeLonger[T any](t assert.Test, slice, other []T, msg ...any)
- func BeLongerString[T ~string](t assert.Test, slice, other T, msg ...any)
- func BeNil(t assert.Test, value any, msg ...any)
- func BeNilError(t assert.Test, err error, msg ...any)
- func BeOfGreaterLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)
- func BeOfGreaterOrEqualLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)
- func BeOfLen[T any](t assert.Test, slice []T, targetLen int, msg ...any)
- func BeOfLesserLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)
- func BeOfLesserOrEqualLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)
- func BeOfSameLength[T any](t assert.Test, slice, other []T, msg ...any)
- func BeShorter[T any](t assert.Test, slice, other []T, msg ...any)
- func BeShorterString[T ~string](t assert.Test, value, other T, msg ...any)
- func BeStringOfGreaterOrEqualLen[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)
- func BeStringOfLen[T ~string](t assert.Test, value T, targetLen int, msg ...any)
- func BeStringOfLenGreaterThan[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)
- func BeStringOfLesserLen[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)
- func BeStringOfLesserOrEqualLen[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)
- func BeStringOfSameLength[T ~string](t assert.Test, value, other T, msg ...any)
- func BeTrue(t assert.Test, value bool, msg ...any)
- func BeZero[T comparable](t assert.Test, item T, msg ...any)
- func Contain[T comparable](t assert.Test, slice []T, item T, msg ...any)
- func ContainKey[K comparable, V any](t assert.Test, m map[K]V, key K, msg ...any)
- func ContainString[T ~string](t assert.Test, value, substr T, msg ...any)
- func DeepContain[T any](t assert.Test, slice []T, value T, msg ...any)
- func DeepEqual[T any](t assert.Test, value, other T, msg ...any)
- func Equal[T comparable](t assert.Test, value, other T, msg ...any)
- func EqualError(t assert.Test, err error, value string, msg ...any)
- func EqualWithinTolerance[T assert.Float](t assert.Test, value, other, tolerance T, msg ...any)
- func NotBeDeepZero(t assert.Test, value any, msg ...any)
- func NotBeEmpty[T any](t assert.Test, slice []T, msg ...any)
- func NotBeEmptyString[T ~string](t assert.Test, value T, msg ...any)
- func NotBeError(t assert.Test, err, targetErr error, msg ...any)
- func NotBeInArray(t assert.Test, array, item any, msg ...any)
- func NotBeInRange[T assert.Ordered](t assert.Test, item, min, max T, msg ...any)
- func NotBeNil(t assert.Test, value any, msg ...any)
- func NotBeNilError(t assert.Test, err error, msg ...any)
- func NotBeOfLen[T any](t assert.Test, slice []T, targetLen int, msg ...any)
- func NotBeOfSameLength[T any](t assert.Test, slice, other []T, msg ...any)
- func NotBeSameLengthString[T ~string](t assert.Test, value, other T, msg ...any)
- func NotBeStringOfLen[T ~string](t assert.Test, value T, targetLen int, msg ...any)
- func NotBeZero[T comparable](t assert.Test, item T, msg ...any)
- func NotContain[T comparable](t assert.Test, slice []T, item T, msg ...any)
- func NotContainKey[K comparable, V any](t assert.Test, m map[K]V, key K, msg ...any)
- func NotContainString[T ~string](t assert.Test, value, substr T, msg ...any)
- func NotDeepContain[T any](t assert.Test, slice []T, item T, msg ...any)
- func NotDeepEqual[T any](t assert.Test, value, other T, msg ...any)
- func NotEqual[T comparable](t assert.Test, value, other T, msg ...any)
- func NotEqualError(t assert.Test, err error, value string, msg ...any)
- func NotPanic(t assert.Test, closure func(), msg ...any)
- func Panic(t assert.Test, closure func(), msg ...any)
- func PanicWith(t assert.Test, closure func(), value any, msg ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeDeepZero ¶
BeDeepZero is asserting that a given value is the zero value for its kind.
It uses reflection to determine whether the value is zero. For comparable values it is preferable to use the must.BeZero, as it performs simple comparison using the '==' operator.
Example: var err error must.BeDeepZero(t, err, "err must be zero value")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeEmpty ¶
BeEmpty is asserting that the given slice holds no items.
Nil value is considered empty.
Example:
must.BeEmpty(t, []string{}, "must have 0 items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeEmptyString ¶
BeEmptyString is asserting that the given string holds no characters.
Example: must.BeEmptyString(t, "", "must have 0 characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeError ¶
BeError is asserting that the given error is a target error.
The errors are compared using errors.Is, so any wrapped errors will work just fine. Example: must.BeError(t, baba(), ErrBabaIsNotYou, "operation baba must have failed with error 'ErrBabaIsNotYou'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeErrorContaining ¶
BeErrorContaining is asserting that the given error is not a nil error and its value contains the provided value.
Example: must.BeErrorContaining(t, baba(), "baba", "operation baba must have failed with an error containing 'baba'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeErrorNotContaining ¶
BeErrorNotContaining is asserting that the given error is not nil and its value does not contain the provided value.
Example: must.BeErrorNotContaining(t, baba(), "flag", "operation baba must have failed with an error not containing 'flag'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeFalse ¶
BeFalse is asserting that the given value is not true.
Example: must.BeFalse(t, isActive, "user must not be active")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeGreater ¶
BeGreater is asserting that a given value is greater than another value.
Example: must.BeGreater(t, 10, 5, "10 must be greater than 5")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeGreaterBytes ¶
BeGreaterBytes is asserting that a given slice of bytes is greater lexicographically than another slice of bytes.
Example:
must.BeGreaterBytes(t, []byte("abc"), []byte("abb"), "first array must be greater lexicographically")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeGreaterOrEqual ¶
BeGreaterOrEqual is asserting that a given value is greater than or equal to another value.
Example: must.BeGreaterOrEqual(t, 5, 4, "5 must be greater or equal to 4")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeGreaterOrEqualBytes ¶
BeGreaterOrEqualBytes is asserting that a given slice of bytes is greater or equal lexicographically to another slice of bytes.
Example:
must.BeGreaterOrEqualBytes(t, []byte("abc"), []byte("abb"), "first must be greater or equal lexicographically")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeInArray ¶
BeInArray is asserting that the given array of items is containing an item.
Items are being compared using reflection by calling reflect.DeepEqual. array must be an array or a pointer to an array, otherwise the function panics.
Example:
must.BeInArray(t, [...]string{"baba", "is", "you"}, "is", "must contain 'is'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeInRange ¶
BeInRange is asserting that a given value fits inclusively within a certain range.
Example: must.BeInRange(t, value, 0, 100, "value must be within range 0-100")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeLesser ¶
BeLesser is asserting that a given value is lesser than another value.
Example: must.BeLesser(t, 5, 10, "5 must be lesser than 10")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeLesserBytes ¶
BeLesserBytes is asserting that a given slice of bytes is lesser lexicographically than another slice of bytes.
Example:
must.BeLesserBytes(t, []byte("abb"), []byte("abc"), "first must be lesser lexicographically")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeLesserOrEqual ¶
BeLesserOrEqual is asserting that a given value is lesser or equal to another value.
Example: must.BeLesserOrEqual(t, 5, 7, "5 must be lesser than or equal to 7")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeLesserOrEqualBytes ¶
BeLesserOrEqualBytes is asserting that a given slice of bytes is lesser or equal lexicographically to another slice of bytes.
Example: must.BeLesserOrEqualBytes(t, babaData, otherData, "babaData must be lesser or equal lexicographically")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeLonger ¶
BeLonger is asserting that the given slice is of greater len than another slice.
Example:
must.BeLonger(t, []string{"baba", "is", "you"}, []string{"flag", "is"}, "must have more items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeLongerString ¶
BeLongerString is asserting that the given string is of greater len than another string.
Example: must.BeLongerString(t, "baba is you", "flag is", "must have more characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeNil ¶
BeNil is asserting that a given value is nil.
Example: must.BeNil(t, value, "value must be nil")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeNilError ¶
BeNilError is asserting that the given error is nil.
Example: must.BeNilError(t, baba(), "operation baba must have passing without an error")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeOfGreaterLen ¶
BeOfGreaterLen is asserting that the given slice is of greater len than a certain threshold.
Example:
must.BeOfGreaterLen(t, []string{"baba", "is", "you"}, 2, "must have at least 3 items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeOfGreaterOrEqualLen ¶
BeOfGreaterOrEqualLen is asserting that the given slice is of greater or equal len to a certain threshold.
Example:
must.BeOfGreaterOrEqualLen(t, []string{"baba", "is", "you"}, 3, "must have 3 or more items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeOfLen ¶
BeOfLen is asserting that the given slice is of certain length.
Example:
must.BeOfLen(t, []string{"baba", "is", "you"}, 3, "must have 3 items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeOfLesserLen ¶
BeOfLesserLen is asserting that the given slice is of lesser len than a certain threshold.
Example:
must.BeOfLesserLen(t, []string{"baba", "is", "you"}, 5, "must have less than 5 items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeOfLesserOrEqualLen ¶
BeOfLesserOrEqualLen is asserting that the given slice is of lesser or equal len to a certain threshold.
Example:
must.BeOfLesserOrEqualLen(t, []string{"baba", "is", "you"}, 5, "must have less or equal to 5 items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeOfSameLength ¶
BeOfSameLength is asserting that the given slice is of equal len to another slice.
Example:
must.BeOfSameLength(t, []string{"baba", "is", "you"}, []string{"flag", "is", "win"}, "must have equal len")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeShorter ¶
BeShorter is asserting that the given slice is of lesser len than another slice.
Example:
must.BeShorter(t, []string{"baba", "is"}, []string{"flag", "is", "win"}, "must have fewer items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeShorterString ¶
BeShorterString is asserting that the given string is of lesser len than another string.
Example: must.BeShorterString(t, "baba is", "flag is win", "must have fewer characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeStringOfGreaterOrEqualLen ¶
BeStringOfGreaterOrEqualLen is asserting that the given string is of greater or equal len to a certain threshold.
Example: must.BeStringOfGreaterOrEqualLen(t, "baba", 4, "must have 4 or more characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeStringOfLen ¶
BeStringOfLen is asserting that the given string is of certain length.
Example: must.BeStringOfLen(t, "baba is you", 11, "must have 11 characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeStringOfLenGreaterThan ¶
BeStringOfLenGreaterThan is asserting that the given string is of greater len than a certain threshold.
Example: must.BeStringOfLenGreaterThan(t, "baba", 3, "must have at least 4 characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeStringOfLesserLen ¶
BeStringOfLesserLen is asserting that the given string is of lesser len than a certain threshold.
Example: must.BeStringOfLesserLen(t, "baba is you", 12, "must have less than 12 characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeStringOfLesserOrEqualLen ¶
BeStringOfLesserOrEqualLen is asserting that the given string is of lesser or equal len to a certain threshold.
Example: must.BeStringOfLesserOrEqualLen(t, "baba is you", 11, "must have at most 11 characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeStringOfSameLength ¶
BeStringOfSameLength is asserting that the given string is of equal len to another string.
Example: must.BeOfSameLength(t, "baba is you", "flag is win", "must have equal len")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeTrue ¶
BeTrue is asserting that the given value is true.
Example: must.BeTrue(t, isActive, "user must be active")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func BeZero ¶
func BeZero[T comparable](t assert.Test, item T, msg ...any)
BeZero is asserting that a given value is the zero value for its kind.
Example: var num int must.BeZero(t, num, "num must be zero")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func Contain ¶
func Contain[T comparable](t assert.Test, slice []T, item T, msg ...any)
Contain is asserting that the given slice is containing an item.
Items are being compared using the '==' operator. For slices of non-comparable items use must.DeepContain. It relies on reflection to perform comparison on the items' values using reflect.DeepEqual.
Example:
must.Contain(t, []string{"baba", "is", "you"}, "is", "must contain 'is'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func ContainKey ¶
func ContainKey[K comparable, V any](t assert.Test, m map[K]V, key K, msg ...any)
ContainKey is asserting that the given map contains a certain key.
Example:
must.ContainKey(t, map[string]any{"baba": "is you"}, "baba", "must contain key 'baba'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func ContainString ¶
ContainString is asserting that the given value is containing a substring.
Example: must.ContainString(t, "baba is you", "baba", "must contain 'baba'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func DeepContain ¶
DeepContain is asserting that the given slice contains a deeply equal value.
Items are being compared using reflection by calling reflect.DeepEqual. For checking slices of items that are comparable it is preferable to use must.Contain which performs simple equality check using the '==' operator.
Example:
must.DeepContain(t, []any{"baba", "is", 5}, "is", "must contain 'is'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func DeepEqual ¶
DeepEqual is asserting that the given values are deeply equal.
Items are being compared using reflect.DeepEqual. For items that are comparable is it preferable to use must.Equal, as it uses simple comparison with the '==' operator.
Example:
must.DeepEqual(t, nums, []any{"1", 2, 3}, "nums must be deeply equal to ["1", 2, 3]")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func Equal ¶
func Equal[T comparable](t assert.Test, value, other T, msg ...any)
Equal is asserting that the given values are equal.
Items are being compared using the '==' operator. For non-comparable values use must.DeepEqual, which uses reflection to compare the values of the items.
Example: must.Equal(t, sentence, "baba is you", "sentence must be equal to 'baba is you'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func EqualError ¶
EqualError is asserting that the given error is not nil and its value is equal to the provided value.
Example: must.EqualError(t, baba(), "baba is not you", "operation baba must have failed with an error 'baba is not you'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func EqualWithinTolerance ¶
EqualWithinTolerance is asserting that a given float value is equal to another float value within a certain tolerance.
Example: must.EqualWithinTolerance(t, value, 5.2, 0.001, "value must be equal to 5.2 with tolerance of 0.001")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeDeepZero ¶
NotBeDeepZero is asserting that a given value is not the zero value for its kind.
It uses reflection to determine whether the value is zero. For comparable values it is
preferable to use the must.NotBeZero, as it performs simple comparison using the '==' operator.
Example:
err := errors,New("baba")
must.NotBeDeepZero(t, err, "err must not be zero value")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeEmpty ¶
NotBeEmpty is asserting that the given slice holds at least one item.
Example:
must.NotBeEmpty(t, []string{"baba"}, "must have at least 1 item")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeEmptyString ¶
NotBeEmptyString is asserting that the given string holds at least one character.
Example: must.NotBeEmptyString(t, "baba", "must have at least 1 character")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeError ¶
NotBeError is asserting that the given error is not a target error.
The errors are compared using errors.Is, so any wrapped errors will work just fine. Example: must.NotBeError(t, baba(), ErrBabaIsNotYou, "operation baba must have failed with error other than 'ErrBabaIsNotYou'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeInArray ¶
NotBeInArray is asserting that the given array of items is not containing an item.
Items are being compared using reflection by calling reflect.DeepEqual. array must be an array or a pointer to an array, otherwise the function panics.
Example:
must.NotBeInArray(t, [...]string{"baba", "is", "you"}, "flag", "must not contain 'flag'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeInRange ¶
NotBeInRange is asserting that a given value falls non-inclusively outside a certain range.
Example: must.NotBeInRange(t, value, 0, 100, "value must be outside of range 0-100")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeNil ¶
NotBeNil is asserting that a given value is not nil.
Example: must.NotBeNil(t, value, "value must not be nil")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeNilError ¶
NotBeNilError is asserting that the given error is not nil.
Example: must.NotBeNilError(t, baba(), "operation baba must have failed with an error")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeOfLen ¶
NotBeOfLen is asserting that the given slice is not of certain length.
Example:
must.NotBeOfLen(t, []string{"baba", "is", "you"}, 5, "must not have 5 items")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeOfSameLength ¶
NotBeOfSameLength is asserting that the given slice is not of equal len to another slice.
Example:
must.NotBeOfSameLength(t, []string{"baba", "is", "you"}, []string{"flag", "is"}, "must have different lengths")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeSameLengthString ¶
NotBeSameLengthString is asserting that the given string is not of equal len to another string.
Example: must.NotBeSameLengthString(t, "baba is you", "flag is", "must have different lengths")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeStringOfLen ¶
NotBeStringOfLen is asserting that the given string is not of certain length.
Example: must.NotBeStringOfLen(t, "baba is you", 5, "must not have 5 characters")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotBeZero ¶
func NotBeZero[T comparable](t assert.Test, item T, msg ...any)
NotBeZero is asserting that a given value is not the zero value for its kind.
Example: num := 5 must.NotBeZero(t, num, "num must not be zero")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotContain ¶
func NotContain[T comparable](t assert.Test, slice []T, item T, msg ...any)
NotContain is asserting that the given slice is not containing an item.
Items are being compared using the '==' operator. For slices of non-comparable items use must.NotDeepContain. It relies on reflection to perform comparison on the items' values using reflect.DeepEqual.
Example:
must.NotContain(t, []string{"baba", "is", "you"}, "flag", "must not contain 'flag'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotContainKey ¶
func NotContainKey[K comparable, V any](t assert.Test, m map[K]V, key K, msg ...any)
NotContainKey is asserting that the given map does not contain a certain key.
Example:
must.NotContainKey(t, map[string]any{"baba": "is you"}, "flag", "must not contain key 'flag'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotContainString ¶
NotContainString is asserting that the given value is not containing a substring.
Example: must.NotContainString(t, "baba is you", "flag", "must not contain 'baba'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotDeepContain ¶
NotDeepContain is asserting that the given slice is not containing a deeply equal item.
Items are being compared using reflection by calling reflect.DeepEqual. For checking slices of items that are comparable it is preferable to use must.NotContain which performs simple equality check using the '==' operator.
Example:
must.NotDeepContain(t, []any{"baba", "is", 5}, "flag", "must not contain 'flag'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotDeepEqual ¶
NotDeepEqual is asserting that the given values are not deeply equal.
Items are being compared using reflect.DeepEqual. For items that are comparable is it preferable to use must.NotEqual, as it uses simple comparison with the '==' operator.
Example:
must.NotDeepEqual(t, nums, []any{"1", 2, 3}, "nums must not be deeply equal to ["1", 2, 3]")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotEqual ¶
func NotEqual[T comparable](t assert.Test, value, other T, msg ...any)
NotEqual is asserting that the given values are not equal.
Items are being compared using the '==' operator. For non-comparable values use must.NotDeepEqual, which uses reflection to compare the values of the items.
Example: must.NotEqual(t, sentence, "baba is you", "sentence must not be equal to 'baba is you'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotEqualError ¶
NotEqualError is asserting that the given error is not nil and its value is not equal to the provided value.
Example: must.NotEqualError(t, baba(), "baba is not you", "operation baba must have failed with error different from 'baba is not you'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func NotPanic ¶
NotPanic is asserting that a given closure function will not panic.
Example:
closure := func () {}
must.NotPanic(t, closure, "closure function must not panic")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func Panic ¶
Panic is asserting that a given closure function will panic.
Example:
closure := func () {
panic("kaboom")
}
must.Panic(t, closure, "closure function must panic")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
func PanicWith ¶
PanicWith is asserting that a given closure function will panic with specific value.
Example:
closure := func () {
panic("kaboom")
}
must.PanicWith(t, closure, "kaboom", "closure function must panic with 'kaboom'")
Failing the test condition will stop the execution of the current test by calling t.FailNow()
Types ¶
This section is empty.