as

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(t testing.TB, want, got interface{}, msgAndArgs ...interface{})

Equal asserts that two objects are equal.

func Error

func Error(t testing.TB, err error, msgAndArgs ...interface{})

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

func Eventually

func Eventually(t testing.TB, condition func(ctx context.Context) bool,
	waitFor, checkInterval time.Duration, msgAndArgs ...interface{})

Eventually asserts that given condition will be met in waitFor time, periodically checking target function each tick.

func False

func False(t testing.TB, ok bool, msgAndArgs ...interface{})

False asserts that the specified value is false.

func Never

func Never(t testing.TB, condition func(ctx context.Context) bool,
	waitFor, checkInterval time.Duration, msgAndArgs ...interface{})

Never asserts that the given condition doesn't satisfy in waitFor time, periodically checking the target function each tick.

func NoError

func NoError(t testing.TB, err error, msgAndArgs ...interface{})

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

func NotEqual

func NotEqual(t testing.TB, want, got interface{}, msgAndArgs ...interface{})

Equal asserts that two objects are not equal.

func NotPanics

func NotPanics(t testing.TB, f PanicTestFunc, msgAndArgs ...interface{})

NotPanics asserts that the code inside the specified PanicTestFunc does not panic.

func NotRegexp

func NotRegexp(t testing.TB, rx interface{}, str string, msgAndArgs ...interface{})

NotRegexp asserts that a specified regexp does not match a string.

func Panics

func Panics(t testing.TB, f PanicTestFunc, msgAndArgs ...interface{})

Panics asserts that the code inside the specified PanicTestFunc panics.

func Regexp

func Regexp(t testing.TB, rx interface{}, str string, msgAndArgs ...interface{})

Regexp asserts that a specified regexp matches a string.

func True

func True(t testing.TB, ok bool, msgAndArgs ...interface{})

True asserts that the specified value is true.

Types

type As

type As struct {
	testing.TB
	// contains filtered or unexported fields
}

As provides check methods around the testing.TB interface.

func New

func New(t testing.TB) *As

New create a new As object for the specified testing.TB.

func (*As) Equal

func (c *As) Equal(want, got interface{}, msgAndArgs ...interface{})

Equal checks that two objects are equal.

func (*As) Error

func (c *As) Error(err error, msgAndArgs ...interface{})

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

func (*As) Eventually

func (c *As) Eventually(condition func(ctx context.Context) bool,
	waitFor, tick time.Duration, msgAndArgs ...interface{})

Eventually checks that given condition will be met in waitFor time, periodically checking target function each tick.

func (*As) FailDirectly

func (a *As) FailDirectly(b bool) *As

FailDirectly specified fail directly for checks of as object.

func (*As) False

func (c *As) False(ok bool, msgAndArgs ...interface{})

False checks that the specified value is false.

func (*As) Never

func (c *As) Never(condition func(ctx context.Context) bool,
	waitFor, tick time.Duration, msgAndArgs ...interface{})

Never checks that the given condition doesn't satisfy in waitFor time, periodically checking the target function each tick.

func (*As) NoError

func (c *As) NoError(err error, msgAndArgs ...interface{})

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

func (*As) NotEqual

func (c *As) NotEqual(want, got interface{}, msgAndArgs ...interface{})

Equal checks that two objects are not equal.

func (*As) NotPanics

func (c *As) NotPanics(f PanicTestFunc, msgAndArgs ...interface{})

NotPanics checks that the code inside the specified PanicTestFunc does not panic.

func (*As) NotRegexp

func (c *As) NotRegexp(rx interface{}, str string, msgAndArgs ...interface{})

NotRegexp checks that a specified regexp does not match a string.

func (*As) Panics

func (c *As) Panics(f PanicTestFunc, msgAndArgs ...interface{})

Panics checks that the code inside the specified PanicTestFunc panics.

func (*As) Regexp

func (c *As) Regexp(rx interface{}, str string, msgAndArgs ...interface{})

Regexp checks that a specified regexp matches a string.

func (*As) True

func (c *As) True(ok bool, msgAndArgs ...interface{})

True checks that the specified value is true.

type PanicTestFunc

type PanicTestFunc func()

PanicTestFunc defines a func that should be passed to the as.Panics and as.NotPanics methods, and represents a simple func that takes no arguments, and returns nothing.

Jump to

Keyboard shortcuts

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