test

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(object interface{}) bool

func IsNil

func IsNil(object interface{}) bool

Types

type Helper

type Helper interface {
	Helper()
}

type T

type T interface {
	Errorf(format string, args ...interface{})
	FailNow()
}

type Tester

type Tester struct {
	T
	ActionOnFail func(T)
}

func Assert

func Assert(t T) *Tester

func Require

func Require(t T) *Tester

func (*Tester) Empty

func (t *Tester) Empty(object interface{}, msgAndArgs ...interface{}) bool

func (*Tester) Equal

func (t *Tester) Equal(expected, actual any, msgAndArgs ...interface{}) bool

func (*Tester) Error

func (t *Tester) Error(err error, msgAndArgs ...interface{}) bool

Error asserts that a function returned an error (i.e. not `nil`).

  actualObj, err := SomeFunction()
  if assert.Error(t, err) {
	   assert.Equal(t, expectedError, err)
  }

func (*Tester) Fail

func (t *Tester) Fail(failureMessage string, msgAndArgs ...interface{}) bool

Fail reports a failure through

func (*Tester) False

func (t *Tester) False(value bool, msgAndArgs ...interface{}) bool

False asserts that the specified value is false.

assert.False(t, myBool)

func (*Tester) Nil

func (t *Tester) Nil(object interface{}, msgAndArgs ...interface{}) bool

func (*Tester) NoError

func (t *Tester) NoError(err error, msgAndArgs ...interface{}) bool

NoError asserts that a function returned no error (i.e. `nil`).

  actualObj, err := SomeFunction()
  if assert.NoError(t, err) {
	   assert.Equal(t, expectedObj, actualObj)
  }

func (*Tester) NotEmpty

func (t *Tester) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool

func (*Tester) NotEqual

func (t *Tester) NotEqual(expected, actual any, msgAndArgs ...interface{}) bool

func (*Tester) NotNil

func (t *Tester) NotNil(object interface{}, msgAndArgs ...interface{}) bool

func (*Tester) True

func (t *Tester) True(value bool, msgAndArgs ...interface{}) bool

True asserts that the specified value is true.

assert.True(t, myBool)

Jump to

Keyboard shortcuts

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