assert

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 3 Imported by: 0

README

Assert Utils

Package assert provides some tool functions for use with the Go testing.

Deprecated: use github.com/gookit/goutil/x/assert.

Install

go get github.com/gookit/goutil/x/assert

GoDocs

Please see Go docs

Function API

generate by: go doc ./testutil/assert

func Contains(t TestingT, src, elem any, fmtAndArgs ...any) bool
func ContainsKey(t TestingT, mp, key any, fmtAndArgs ...any) bool
func ContainsKeys(t TestingT, mp any, keys any, fmtAndArgs ...any) bool
func DisableColor()
func Empty(t TestingT, give any, fmtAndArgs ...any) bool
func Eq(t TestingT, want, give any, fmtAndArgs ...any) bool
func Equal(t TestingT, want, give any, fmtAndArgs ...any) bool
func Err(t TestingT, err error, fmtAndArgs ...any) bool
func ErrIs(t TestingT, err, wantErr error, fmtAndArgs ...any) bool
func ErrMsg(t TestingT, err error, wantMsg string, fmtAndArgs ...any) bool
func ErrSubMsg(t TestingT, err error, subMsg string, fmtAndArgs ...any) bool
func Fail(t TestingT, failMsg string, fmtAndArgs ...any) bool
func FailNow(t TestingT, failMsg string, fmtAndArgs ...any) bool
func False(t TestingT, give bool, fmtAndArgs ...any) bool
func Gt(t TestingT, give, min int, fmtAndArgs ...any) bool
func HideFullPath()
func IsKind(t TestingT, wantKind reflect.Kind, give any, fmtAndArgs ...any) bool
func IsType(t TestingT, wantType, give any, fmtAndArgs ...any) bool
func Len(t TestingT, give any, wantLn int, fmtAndArgs ...any) bool
func LenGt(t TestingT, give any, minLn int, fmtAndArgs ...any) bool
func Lt(t TestingT, give, max int, fmtAndArgs ...any) bool
func Neq(t TestingT, want, give any, fmtAndArgs ...any) bool
func Nil(t TestingT, give any, fmtAndArgs ...any) bool
func NoErr(t TestingT, err error, fmtAndArgs ...any) bool
func NotContains(t TestingT, src, elem any, fmtAndArgs ...any) bool
func NotEmpty(t TestingT, give any, fmtAndArgs ...any) bool
func NotEq(t TestingT, want, give any, fmtAndArgs ...any) bool
func NotEqual(t TestingT, want, give any, fmtAndArgs ...any) bool
func NotNil(t TestingT, give any, fmtAndArgs ...any) bool
func NotPanics(t TestingT, fn PanicRunFunc, fmtAndArgs ...any) bool
func NotSame(t TestingT, want, actual any, fmtAndArgs ...any) bool
func Panics(t TestingT, fn PanicRunFunc, fmtAndArgs ...any) bool
func PanicsErrMsg(t TestingT, fn PanicRunFunc, errMsg string, fmtAndArgs ...any) bool
func PanicsMsg(t TestingT, fn PanicRunFunc, wantVal interface{}, fmtAndArgs ...any) bool
func Same(t TestingT, wanted, actual any, fmtAndArgs ...any) bool
func StrContains(t TestingT, s, sub string, fmtAndArgs ...any) bool
func True(t TestingT, give bool, fmtAndArgs ...any) bool
type Assertions struct{ ... }
    func New(t TestingT) *Assertions

Code Check & Testing

gofmt -w -l ./
golint ./...
go test ./...

Documentation

Overview

Package assert provides compatibility for the old assert import path.

Deprecated: use github.com/gookit/goutil/x/assert.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ShowFullPath on show error trace.
	//
	// Deprecated: use github.com/gookit/goutil/x/assert.ShowFullPath.
	ShowFullPath = xassert.ShowFullPath
	// EnableColor on show error trace.
	//
	// Deprecated: use github.com/gookit/goutil/x/assert.EnableColor.
	EnableColor = xassert.EnableColor
	// FailFast fail fast, stop test when first error(will call testing.T.FailNow()).
	//
	// Deprecated: use github.com/gookit/goutil/x/assert.FailFast.
	FailFast = xassert.FailFast
)

Functions

func Contains deprecated

func Contains(t TestingT, src, elem any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Contains.

func ContainsElems deprecated added in v0.6.16

func ContainsElems[T comdef.ScalarType](t TestingT, list, sub []T, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ContainsElems.

func ContainsElemsAny deprecated added in v0.7.5

func ContainsElemsAny(t TestingT, list, sub any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ContainsElemsAny.

func ContainsKey deprecated

func ContainsKey(t TestingT, mp, key any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ContainsKey.

func ContainsKeys deprecated added in v0.5.8

func ContainsKeys(t TestingT, mp any, keys any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ContainsKeys.

func DirExists deprecated added in v0.7.0

func DirExists(t TestingT, dirPath string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.DirExists.

func DirNotExists deprecated added in v0.7.0

func DirNotExists(t TestingT, dirPath string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.DirNotExists.

func DisableColor deprecated

func DisableColor()

Deprecated: use github.com/gookit/goutil/x/assert.DisableColor.

func Empty deprecated

func Empty(t TestingT, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Empty.

func Eq deprecated

func Eq(t TestingT, want, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Eq.

func EqFloat deprecated added in v0.7.4

func EqFloat(t TestingT, want, give any, delta float64, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.EqFloat.

func EqInt deprecated added in v0.7.4

func EqInt(t TestingT, want, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.EqInt.

func Equal deprecated added in v0.6.0

func Equal(t TestingT, want, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Equal.

func Err deprecated

func Err(t TestingT, err error, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Err.

func ErrHasMsg deprecated added in v0.7.4

func ErrHasMsg(t TestingT, err error, subMsg string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ErrHasMsg.

func ErrIs deprecated added in v0.5.10

func ErrIs(t TestingT, err, wantErr error, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ErrIs.

func ErrMsg deprecated

func ErrMsg(t TestingT, err error, wantMsg string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ErrMsg.

func ErrMsgContains deprecated added in v0.7.0

func ErrMsgContains(t TestingT, err error, subMsg string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ErrMsgContains.

func ErrSubMsg deprecated

func ErrSubMsg(t TestingT, err error, subMsg string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.ErrSubMsg.

func Error deprecated added in v0.6.0

func Error(t TestingT, err error, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Error.

func Fail deprecated

func Fail(t TestingT, failMsg string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Fail.

func FailNow deprecated

func FailNow(t TestingT, failMsg string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.FailNow.

func False deprecated

func False(t TestingT, give bool, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.False.

func FileExists deprecated added in v0.7.0

func FileExists(t TestingT, filePath string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.FileExists.

func FileNotExists deprecated added in v0.7.0

func FileNotExists(t TestingT, filePath string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.FileNotExists.

func Gt deprecated

func Gt(t TestingT, give, min any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Gt.

func Gte deprecated added in v0.6.7

func Gte(t TestingT, give, min any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Gte.

func HideFullPath deprecated

func HideFullPath()

Deprecated: use github.com/gookit/goutil/x/assert.HideFullPath.

func InDelta deprecated added in v0.7.4

func InDelta(t TestingT, want, give any, delta float64, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.InDelta.

func IsKind deprecated added in v0.5.9

func IsKind(t TestingT, wantKind reflect.Kind, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.IsKind.

func IsType deprecated added in v0.5.8

func IsType(t TestingT, wantType, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.IsType.

func Len deprecated

func Len(t TestingT, give any, wantLn int, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Len.

func LenGt deprecated

func LenGt(t TestingT, give any, minLn int, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.LenGt.

func Lt deprecated

func Lt(t TestingT, give, max any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Lt.

func Lte deprecated added in v0.6.7

func Lte(t TestingT, give, max any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Lte.

func Must deprecated added in v0.7.4

func Must(t TestingT, condition bool, fmtAndArgs ...any)

Deprecated: use github.com/gookit/goutil/x/assert.Must.

func Neq deprecated

func Neq(t TestingT, want, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Neq.

func Nil deprecated

func Nil(t TestingT, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Nil.

func NoErr deprecated

func NoErr(t TestingT, err error, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NoErr.

func NoError deprecated added in v0.6.0

func NoError(t TestingT, err error, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NoError.

func NotContains deprecated added in v0.5.7

func NotContains(t TestingT, src, elem any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotContains.

func NotContainsKey deprecated added in v0.6.9

func NotContainsKey(t TestingT, mp, key any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotContainsKey.

func NotContainsKeys deprecated added in v0.6.9

func NotContainsKeys(t TestingT, mp any, keys any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotContainsKeys.

func NotEmpty deprecated

func NotEmpty(t TestingT, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotEmpty.

func NotEq deprecated

func NotEq(t TestingT, want, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotEq.

func NotEqual deprecated added in v0.6.0

func NotEqual(t TestingT, want, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotEqual.

func NotNil deprecated

func NotNil(t TestingT, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotNil.

func NotPanics deprecated

func NotPanics(t TestingT, fn PanicRunFunc, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotPanics.

func NotSame deprecated added in v0.5.8

func NotSame(t TestingT, want, actual any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotSame.

func NotZero deprecated added in v0.7.4

func NotZero(t TestingT, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.NotZero.

func Panics deprecated

func Panics(t TestingT, fn PanicRunFunc, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Panics.

func PanicsErrMsg deprecated

func PanicsErrMsg(t TestingT, fn PanicRunFunc, errMsg string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.PanicsErrMsg.

func PanicsMsg deprecated

func PanicsMsg(t TestingT, fn PanicRunFunc, wantVal any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.PanicsMsg.

func Require deprecated added in v0.7.4

func Require(t TestingT, condition bool, fmtAndArgs ...any)

Deprecated: use github.com/gookit/goutil/x/assert.Require.

func Same deprecated added in v0.5.8

func Same(t TestingT, wanted, actual any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Same.

func SetFailFast deprecated added in v0.7.4

func SetFailFast(enable bool)

Deprecated: use github.com/gookit/goutil/x/assert.SetFailFast.

func StrContains deprecated

func StrContains(t TestingT, s, sub string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.StrContains.

func StrContainsAll deprecated added in v0.7.2

func StrContainsAll(t TestingT, s string, subs []string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.StrContainsAll.

func StrCount deprecated added in v0.6.9

func StrCount(t TestingT, s, sub string, count int, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.StrCount.

func StrNotContains deprecated added in v0.6.16

func StrNotContains(t TestingT, s, sub string, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.StrNotContains.

func True deprecated

func True(t TestingT, give bool, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.True.

func Zero deprecated added in v0.7.4

func Zero(t TestingT, give any, fmtAndArgs ...any) bool

Deprecated: use github.com/gookit/goutil/x/assert.Zero.

Types

type Assertions

type Assertions struct {

	// prefix message for each assert TODO
	Msg string
	// contains filtered or unexported fields
}

Assertions provide assertion methods around the TestingT interface.

func New

func New(t TestingT) *Assertions

New makes a new Assertions object for the specified TestingT

Usage:

as := assert.New(t)
as.True(true)

func (*Assertions) Contains

func (as *Assertions) Contains(src, elem any, fmtAndArgs ...any) *Assertions

Contains asserts that the given data(string,slice,map) should contain element

func (*Assertions) ContainsElems added in v0.7.5

func (as *Assertions) ContainsElems(list any, sub any, fmtAndArgs ...any) *Assertions

ContainsElems asserts that the given list should contain sub elements

func (*Assertions) ContainsKey

func (as *Assertions) ContainsKey(mp, key any, fmtAndArgs ...any) *Assertions

ContainsKey asserts that the given map is contains key

func (*Assertions) ContainsKeys added in v0.7.5

func (as *Assertions) ContainsKeys(mp any, keys any, fmtAndArgs ...any) *Assertions

ContainsKeys asserts that the map is contains all given keys

func (*Assertions) DirExists added in v0.7.5

func (as *Assertions) DirExists(dirPath string, fmtAndArgs ...any) *Assertions

DirExists asserts that the given dir exists

func (*Assertions) DirNotExists added in v0.7.5

func (as *Assertions) DirNotExists(dirPath string, fmtAndArgs ...any) *Assertions

DirNotExists asserts that the given dir not exists

func (*Assertions) Empty

func (as *Assertions) Empty(give any, fmtAndArgs ...any) *Assertions

Empty check, please see Empty()

func (*Assertions) Eq

func (as *Assertions) Eq(want, give any, fmtAndArgs ...any) *Assertions

Eq asserts that the want should equal to the given

func (*Assertions) EqFloat added in v0.7.5

func (as *Assertions) EqFloat(want, give any, delta float64, fmtAndArgs ...any) *Assertions

EqFloat asserts that the want should equal to the given float with delta

func (*Assertions) EqInt added in v0.7.5

func (as *Assertions) EqInt(want, give any, fmtAndArgs ...any) *Assertions

EqInt asserts that the want should equal to the given intX

func (*Assertions) Equal added in v0.6.7

func (as *Assertions) Equal(want, give any, fmtAndArgs ...any) *Assertions

Equal asserts that the want should equal to the given

Alias of Eq()

func (*Assertions) Err

func (as *Assertions) Err(err error, fmtAndArgs ...any) *Assertions

Err asserts that the given is a not nil error

func (*Assertions) ErrHasMsg added in v0.7.5

func (as *Assertions) ErrHasMsg(err error, subMsg string, fmtAndArgs ...any) *Assertions

ErrHasMsg asserts that the given is a not nil error and the error message contains subMsg

func (*Assertions) ErrIs added in v0.5.10

func (as *Assertions) ErrIs(err, wantErr error, fmtAndArgs ...any) *Assertions

ErrIs asserts that the given error is equals wantErr

func (*Assertions) ErrMsg

func (as *Assertions) ErrMsg(err error, errMsg string, fmtAndArgs ...any) *Assertions

ErrMsg asserts that the given is a not nil error and error message equals wantMsg

func (*Assertions) ErrMsgContains added in v0.7.5

func (as *Assertions) ErrMsgContains(err error, subMsg string, fmtAndArgs ...any) *Assertions

ErrMsgContains asserts that the given is a not nil error and error message contains subMsg

func (*Assertions) ErrSubMsg

func (as *Assertions) ErrSubMsg(err error, subMsg string, fmtAndArgs ...any) *Assertions

ErrSubMsg asserts that the given is a not nil error and the error message contains subMsg

func (*Assertions) Error added in v0.6.7

func (as *Assertions) Error(err error, fmtAndArgs ...any) *Assertions

Error asserts that the given is a not nil error

func (*Assertions) Fail

func (as *Assertions) Fail(failMsg string, fmtAndArgs ...any) *Assertions

Fail reports a failure through

func (*Assertions) FailNow

func (as *Assertions) FailNow(failMsg string, fmtAndArgs ...any) *Assertions

FailNow fails test

func (*Assertions) False

func (as *Assertions) False(give bool, fmtAndArgs ...any) *Assertions

False check, please see False()

func (*Assertions) FileExists added in v0.7.5

func (as *Assertions) FileExists(filePath string, fmtAndArgs ...any) *Assertions

FileExists asserts that the given file exists

func (*Assertions) FileNotExists added in v0.7.5

func (as *Assertions) FileNotExists(filePath string, fmtAndArgs ...any) *Assertions

FileNotExists asserts that the given file not exists

func (*Assertions) Gt

func (as *Assertions) Gt(give, min any, fmtAndArgs ...any) *Assertions

Gt asserts that the give(intX) should not be greater than min

func (*Assertions) Gte added in v0.6.7

func (as *Assertions) Gte(give, min any, fmtAndArgs ...any) *Assertions

Gte asserts that the give(intX) should not be greater than or equal to min

func (*Assertions) InDelta added in v0.7.5

func (as *Assertions) InDelta(want, give any, delta float64, fmtAndArgs ...any) *Assertions

InDelta asserts that two floating-point values differ within a certain range

func (*Assertions) IsFail

func (as *Assertions) IsFail() bool

IsFail for last check

func (*Assertions) IsKind added in v0.7.5

func (as *Assertions) IsKind(wantKind reflect.Kind, give any, fmtAndArgs ...any) *Assertions

IsKind asserts that the given data reflect.Kind equals

func (*Assertions) IsOk

func (as *Assertions) IsOk() bool

IsOk for last check

func (*Assertions) IsType added in v0.5.8

func (as *Assertions) IsType(wantType, give any, fmtAndArgs ...any) *Assertions

IsType type equals assert

func (*Assertions) Len

func (as *Assertions) Len(give any, wantLn int, fmtAndArgs ...any) *Assertions

Len assert given length is equals to wantLn

func (*Assertions) LenGt

func (as *Assertions) LenGt(give any, minLn int, fmtAndArgs ...any) *Assertions

LenGt assert given length is greater than to minLn

func (*Assertions) Lt

func (as *Assertions) Lt(give, max any, fmtAndArgs ...any) *Assertions

Lt asserts that the give(intX) should not be less than max

func (*Assertions) Lte added in v0.6.7

func (as *Assertions) Lte(give, max any, fmtAndArgs ...any) *Assertions

Lte asserts that the give(intX) should not be less than or equal to max

func (*Assertions) Neq

func (as *Assertions) Neq(want, give any, fmtAndArgs ...any) *Assertions

Neq asserts that the want should not be equal to the given. alias of NotEq()

func (*Assertions) Nil

func (as *Assertions) Nil(give any, fmtAndArgs ...any) *Assertions

Nil asserts that the given is a nil value

func (*Assertions) NoErr

func (as *Assertions) NoErr(err error, fmtAndArgs ...any) *Assertions

NoErr asserts that the given is a nil error

func (*Assertions) NoError added in v0.6.11

func (as *Assertions) NoError(err error, fmtAndArgs ...any) *Assertions

NoError asserts that the given is a nil error

func (*Assertions) NotContains added in v0.5.7

func (as *Assertions) NotContains(src, elem any, fmtAndArgs ...any) *Assertions

NotContains asserts that the given data(string,slice,map) should not contain element

func (*Assertions) NotContainsKey added in v0.7.5

func (as *Assertions) NotContainsKey(mp, key any, fmtAndArgs ...any) *Assertions

NotContainsKey asserts that the given map is not contains key

func (*Assertions) NotContainsKeys added in v0.7.5

func (as *Assertions) NotContainsKeys(mp any, keys any, fmtAndArgs ...any) *Assertions

NotContainsKeys asserts that the map is not contains all given keys

func (*Assertions) NotEmpty

func (as *Assertions) NotEmpty(give any, fmtAndArgs ...any) *Assertions

NotEmpty check, please see NotEmpty()

func (*Assertions) NotEq

func (as *Assertions) NotEq(want, give any, fmtAndArgs ...any) *Assertions

NotEq asserts that the want should not be equal to the given

func (*Assertions) NotEqual added in v0.6.7

func (as *Assertions) NotEqual(want, give any, fmtAndArgs ...any) *Assertions

NotEqual asserts that the want should not be equal to the given

Alias of NotEq()

func (*Assertions) NotNil

func (as *Assertions) NotNil(val any, fmtAndArgs ...any) *Assertions

NotNil asserts that the given is a not nil value

func (*Assertions) NotPanics

func (as *Assertions) NotPanics(fn PanicRunFunc, fmtAndArgs ...any) *Assertions

NotPanics check, please see NotPanics()

func (*Assertions) NotSame added in v0.7.5

func (as *Assertions) NotSame(want, actual any, fmtAndArgs ...any) *Assertions

NotSame asserts that two pointers do not reference the same object

func (*Assertions) NotZero added in v0.7.5

func (as *Assertions) NotZero(give any, fmtAndArgs ...any) *Assertions

NotZero check, please see NotZero()

func (*Assertions) Panics

func (as *Assertions) Panics(fn PanicRunFunc, fmtAndArgs ...any) *Assertions

Panics check, please see Panics()

func (*Assertions) PanicsErrMsg

func (as *Assertions) PanicsErrMsg(fn PanicRunFunc, errMsg string, fmtAndArgs ...any) *Assertions

PanicsErrMsg check, please see PanicsErrMsg()

func (*Assertions) PanicsMsg

func (as *Assertions) PanicsMsg(fn PanicRunFunc, wantVal any, fmtAndArgs ...any) *Assertions

PanicsMsg check, please see PanicsMsg()

func (*Assertions) Same added in v0.7.5

func (as *Assertions) Same(wanted, actual any, fmtAndArgs ...any) *Assertions

Same asserts that two pointers reference the same object

func (*Assertions) StrContains

func (as *Assertions) StrContains(s, sub string, fmtAndArgs ...any) *Assertions

StrContains asserts that the given strings is contains sub-string

func (*Assertions) StrContainsAll added in v0.7.5

func (as *Assertions) StrContainsAll(s string, subs []string, fmtAndArgs ...any) *Assertions

StrContainsAll asserts that the given strings is contains all sub-strings

func (*Assertions) StrCount added in v0.7.5

func (as *Assertions) StrCount(s, sub string, count int, fmtAndArgs ...any) *Assertions

StrCount asserts that the given strings contains substring count

func (*Assertions) StrNotContains added in v0.7.5

func (as *Assertions) StrNotContains(s, sub string, fmtAndArgs ...any) *Assertions

StrNotContains asserts that the given strings is not contains sub-string

func (*Assertions) True

func (as *Assertions) True(give bool, fmtAndArgs ...any) *Assertions

True check, please see True()

func (*Assertions) WithMsg added in v0.6.9

func (as *Assertions) WithMsg(msg string) *Assertions

WithMsg set with prefix message.

func (*Assertions) Zero added in v0.7.5

func (as *Assertions) Zero(give any, fmtAndArgs ...any) *Assertions

Zero check, please see Zero()

type PanicRunFunc deprecated

type PanicRunFunc = xassert.PanicRunFunc

PanicRunFunc define.

Deprecated: use github.com/gookit/goutil/x/assert.PanicRunFunc.

type TestingT deprecated

type TestingT = xassert.TestingT

TestingT is an interface wrapper around *testing.T.

Deprecated: use github.com/gookit/goutil/x/assert.TestingT.

Jump to

Keyboard shortcuts

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