must

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeDeepZero

func BeDeepZero(t assert.Test, value any, msg ...any)

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

func BeEmpty[T any](t assert.Test, slice []T, msg ...any)

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

func BeEmptyString[T ~string](t assert.Test, value T, msg ...any)

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

func BeError(t assert.Test, err, targetErr error, msg ...any)

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

func BeErrorContaining(t assert.Test, err error, value string, msg ...any)

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

func BeErrorNotContaining(t assert.Test, err error, value string, msg ...any)

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

func BeFalse(t assert.Test, value bool, msg ...any)

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

func BeGreater[T assert.Ordered](t assert.Test, value, other T, msg ...any)

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

func BeGreaterBytes(t assert.Test, value, other []byte, msg ...any)

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

func BeGreaterOrEqual[T assert.Ordered](t assert.Test, value, other T, msg ...any)

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

func BeGreaterOrEqualBytes(t assert.Test, itemA, itemB []byte, msg ...any)

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

func BeInArray(t assert.Test, array, item any, msg ...any)

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

func BeInRange[T assert.Ordered](t assert.Test, item, min, max T, msg ...any)

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

func BeLesser[T assert.Ordered](t assert.Test, value, other T, msg ...any)

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

func BeLesserBytes(t assert.Test, value, other []byte, msg ...any)

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

func BeLesserOrEqual[T assert.Ordered](t assert.Test, value, other T, msg ...any)

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

func BeLesserOrEqualBytes(t assert.Test, itemA, itemB []byte, msg ...any)

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

func BeLonger[T any](t assert.Test, slice, other []T, msg ...any)

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

func BeLongerString[T ~string](t assert.Test, slice, other T, msg ...any)

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

func BeNil(t assert.Test, value any, msg ...any)

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

func BeNilError(t assert.Test, err error, msg ...any)

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

func BeOfGreaterLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)

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

func BeOfGreaterOrEqualLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)

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

func BeOfLen[T any](t assert.Test, slice []T, targetLen int, msg ...any)

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

func BeOfLesserLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)

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

func BeOfLesserOrEqualLen[T any](t assert.Test, slice []T, thresholdLen int, msg ...any)

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

func BeOfSameLength[T any](t assert.Test, slice, other []T, msg ...any)

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

func BeShorter[T any](t assert.Test, slice, other []T, msg ...any)

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

func BeShorterString[T ~string](t assert.Test, value, other T, msg ...any)

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

func BeStringOfGreaterOrEqualLen[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)

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

func BeStringOfLen[T ~string](t assert.Test, value T, targetLen int, msg ...any)

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

func BeStringOfLenGreaterThan[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)

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

func BeStringOfLesserLen[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)

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

func BeStringOfLesserOrEqualLen[T ~string](t assert.Test, value T, thresholdLen int, msg ...any)

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

func BeStringOfSameLength[T ~string](t assert.Test, value, other T, msg ...any)

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

func BeTrue(t assert.Test, value bool, msg ...any)

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

func ContainString[T ~string](t assert.Test, value, substr T, msg ...any)

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

func DeepContain[T any](t assert.Test, slice []T, value T, msg ...any)

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

func DeepEqual[T any](t assert.Test, value, other T, msg ...any)

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

func EqualError(t assert.Test, err error, value string, msg ...any)

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

func EqualWithinTolerance[T assert.Float](t assert.Test, value, other, tolerance T, msg ...any)

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

func NotBeDeepZero(t assert.Test, value any, msg ...any)

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

func NotBeEmpty[T any](t assert.Test, slice []T, msg ...any)

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

func NotBeEmptyString[T ~string](t assert.Test, value T, msg ...any)

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

func NotBeError(t assert.Test, err, targetErr error, msg ...any)

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

func NotBeInArray(t assert.Test, array, item any, msg ...any)

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

func NotBeInRange[T assert.Ordered](t assert.Test, item, min, max T, msg ...any)

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

func NotBeNil(t assert.Test, value any, msg ...any)

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

func NotBeNilError(t assert.Test, err error, msg ...any)

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

func NotBeOfLen[T any](t assert.Test, slice []T, targetLen int, msg ...any)

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

func NotBeOfSameLength[T any](t assert.Test, slice, other []T, msg ...any)

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

func NotBeSameLengthString[T ~string](t assert.Test, value, other T, msg ...any)

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

func NotBeStringOfLen[T ~string](t assert.Test, value T, targetLen int, msg ...any)

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

func NotContainString[T ~string](t assert.Test, value, substr T, msg ...any)

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

func NotDeepContain[T any](t assert.Test, slice []T, item T, msg ...any)

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

func NotDeepEqual[T any](t assert.Test, value, other T, msg ...any)

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

func NotEqualError(t assert.Test, err error, value string, msg ...any)

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

func NotPanic(t assert.Test, closure func(), msg ...any)

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

func Panic(t assert.Test, closure func(), msg ...any)

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

func PanicWith(t assert.Test, closure func(), value any, msg ...any)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL