testutil

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReaderErr = errors.New("reader error")

Functions

func CreateStruct

func CreateStruct(fieldNum int) (v any, asMapBytes []byte, asArrayBytes []byte)

CreateStruct returns a struct that is made dynamically and encoded bytes.

func Equal

func Equal[T any](t *testing.T, actual, expected T)

func EqualEqualer

func EqualEqualer[T Equaler[T]](t *testing.T, actual, expected T)

func EqualMap

func EqualMap[K comparable, V comparable](t *testing.T, actual, expected map[K]V)

func EqualSlice

func EqualSlice[T comparable](t *testing.T, actual, expected []T)

func Error

func Error(t *testing.T, err error)

func ErrorContains

func ErrorContains(t *testing.T, err error, errStr string)

func IsError

func IsError(t *testing.T, actual, expected error)

func NoError

func NoError(t *testing.T, err error)

Types

type Equaler

type Equaler[T any] interface {
	Equal(other T) bool
}

type ErrReader

type ErrReader struct{}

func NewErrReader

func NewErrReader() *ErrReader

func (ErrReader) Read

func (ErrReader) Read(_ []byte) (int, error)

type TestReader

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

func NewTestReader

func NewTestReader(b []byte) *TestReader

func (*TestReader) Count

func (r *TestReader) Count() int

func (*TestReader) Read

func (r *TestReader) Read(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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