fst

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: MIT Imports: 9 Imported by: 1

README

fst

A simple and clean unit testing toolkit.

Some features are inspired by Testify.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v0.0.4

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 added in v0.0.6

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

func ErrorIs added in v0.0.2

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

func ErrorNotContains added in v0.0.6

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 added in v0.0.2

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

func GreaterOrEqual added in v0.0.2

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

func HasPrefix added in v0.0.4

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

func HasSuffix added in v0.0.4

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

func Len added in v0.0.3

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

func Less added in v0.0.2

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

func LessOrEqual added in v0.0.2

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 added in v0.0.4

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 added in v0.0.2

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

func NotNil

func NotNil(t Testing, got any)

func NotPrefix added in v0.0.4

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

func NotSamePtr

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

func NotSuffix added in v0.0.4

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

func Panic added in v0.0.3

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, item E)

func SliceNotContains

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

func SliceSortEqual added in v0.0.6

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

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

func SliceSortNotEqual added in v0.0.6

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 added in v0.0.6

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

func WithHTTPResponse added in v0.0.6

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

func (*HTTPResponseChecker) StatusCodeEqual added in v0.0.6

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

func (*HTTPResponseChecker) StatusCodeNotEqual added in v0.0.6

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

type Helper

type Helper interface {
	Helper()
}

type StringByte added in v0.0.4

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