xt

package
v0.0.0-...-ac6d18a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

README

xt

A simple and clean unit testing toolkit.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T StringByte](t Testing, s T, substr T)

func DirExists

func DirExists(t Testing, path string)

func DirNotExists

func DirNotExists(t Testing, path string)

func Empty

func Empty(t Testing, got any)

func Equal

func Equal[T any](t Testing, expected T, actual T)

func Error

func Error(t Testing, err error)

func ErrorContains

func ErrorContains(t Testing, err error, substr string)

func ErrorIs

func ErrorIs(t Testing, err error, target error)

func ErrorNotContains

func ErrorNotContains(t Testing, err error, substr string)

func False

func False(t Testing, got bool)

func FileExists

func FileExists(t Testing, path string)

func FileNotExists

func FileNotExists(t Testing, path string)

func Greater

func Greater[T cmp.Ordered](t Testing, x T, y T)

func GreaterOrEqual

func GreaterOrEqual[T cmp.Ordered](t Testing, x T, y T)

func HasPrefix

func HasPrefix[T StringByte](t Testing, s T, prefix T)

func HasSuffix

func HasSuffix[T StringByte](t Testing, s T, prefix T)

func Len

func Len(t Testing, object any, length int)

func Less

func Less[T cmp.Ordered](t Testing, x T, y T)

func LessOrEqual

func LessOrEqual[T cmp.Ordered](t Testing, x T, y T)

func Nil

func Nil(t Testing, got any)

func NoError

func NoError(t Testing, err error)

func NotContains

func NotContains[T StringByte](t Testing, s T, substr T)

func NotEmpty

func NotEmpty(t Testing, got any)

func NotEqual

func NotEqual[T any](t Testing, expected T, actual T)

func NotErrorIs

func NotErrorIs(t Testing, err error, target error)

func NotNil

func NotNil(t Testing, got any)

func NotPrefix

func NotPrefix[T StringByte](t Testing, s T, prefix T)

func NotSamePtr

func NotSamePtr(t Testing, expected any, actual any)

func NotSuffix

func NotSuffix[T StringByte](t Testing, s T, prefix T)

func Panic

func Panic(t Testing, fn func())

func SamePtr

func SamePtr(t Testing, expected any, actual any)

func SliceContains

func SliceContains[S ~[]E, E comparable](t Testing, values S, items ...E)

SliceContains 检查 values 是否包含 items

func SliceNotContains

func SliceNotContains[S ~[]E, E comparable](t Testing, values S, items ...E)

SliceNotContains 检查 values 没哟包含 items

func SliceSortEqual

func SliceSortEqual[S ~[]E, E cmp.Ordered](t Testing, expected S, actual S)

SliceSortEqual 将两个 slice 排序后比较内容是否一样

func SliceSortNotEqual

func SliceSortNotEqual[S ~[]E, E cmp.Ordered](t Testing, expected S, actual S)

SliceSortNotEqual 将两个 slice 排序后比较内容是否不一样

func True

func True(t Testing, got bool)

Types

type HTTPResponseChecker

type HTTPResponseChecker struct {
	// contains filtered or unexported fields
}

func WithHTTPResponse

func WithHTTPResponse(t Testing, resp *http.Response) *HTTPResponseChecker

func (*HTTPResponseChecker) StatusCodeEqual

func (hc *HTTPResponseChecker) StatusCodeEqual(code int) *HTTPResponseChecker

func (*HTTPResponseChecker) StatusCodeNotEqual

func (hc *HTTPResponseChecker) StatusCodeNotEqual(code int) *HTTPResponseChecker

type Helper

type Helper interface {
	Helper()
}

type StringByte

type StringByte interface {
	~string | ~[]byte
}

type Testing

type Testing interface {
	Fatalf(format string, args ...any)
}

Jump to

Keyboard shortcuts

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