assert

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(msg string, args ...any)

Fail the current test case with given message

func RegisterT

func RegisterT(t *testing.T)

RegisterT saves current testing.T for further usage by Expect

Types

type AnyAssertions

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

AnyAssertions is used to assert any kind of value

func Expect

func Expect(actual any) *AnyAssertions

Expect starts new assertions on given value

func (AnyAssertions) ContainsProps added in v0.20.0

func (a AnyAssertions) ContainsProps(props map[string]any) bool

func (*AnyAssertions) ContainsSubstring

func (a *AnyAssertions) ContainsSubstring(substr string) bool

ContainsSubstring asserts that actual value contains given substring

func (*AnyAssertions) Equals

func (a *AnyAssertions) Equals(expected any) bool

Equals asserts that actual value equals expected value

func (*AnyAssertions) EventuallyEquals

func (a *AnyAssertions) EventuallyEquals(expected any) bool

EventuallyEquals asserts that, within 30 seconds, the actual function will return same value as expected value

func (*AnyAssertions) HasLen

func (a *AnyAssertions) HasLen(expected int) bool

HasLen asserts that actual value has an expected length

func (*AnyAssertions) IsEmpty

func (a *AnyAssertions) IsEmpty() bool

IsEmpty asserts that actual value is empty

func (*AnyAssertions) IsFalse

func (a *AnyAssertions) IsFalse() bool

IsFalse asserts that actual value is false

func (*AnyAssertions) IsNil

func (a *AnyAssertions) IsNil() bool

IsNil asserts that actual value is nil

func (*AnyAssertions) IsNotEmpty

func (a *AnyAssertions) IsNotEmpty() bool

IsNotEmpty asserts that actual value is not empty

func (*AnyAssertions) IsNotNil

func (a *AnyAssertions) IsNotNil() bool

IsNotNil asserts that actual value is not nil

func (*AnyAssertions) IsTrue

func (a *AnyAssertions) IsTrue() bool

IsTrue asserts that actual value is true

func (*AnyAssertions) NotEquals

func (a *AnyAssertions) NotEquals(other any) bool

NotEquals asserts that actual value is different than given value

func (*AnyAssertions) Panics

func (a *AnyAssertions) Panics() (panicked bool)

Panics asserts that actual value panics whenever called

func (*AnyAssertions) TemporarilySimilar

func (a *AnyAssertions) TemporarilySimilar(other time.Time, diff time.Duration) bool

TemporarilySimilar asserts that actual value is between a range of other time value

type BusHandlerAssertions added in v0.20.0

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

func ExpectHandler added in v0.20.0

func ExpectHandler(msg bus.Msg) *BusHandlerAssertions

ExpectHandler is used to assert bus operations

func (*BusHandlerAssertions) CalledOnce added in v0.20.0

func (a *BusHandlerAssertions) CalledOnce() bool

CalledOnce asserts that a particular handler was called once

func (*BusHandlerAssertions) CalledTimes added in v0.20.0

func (a *BusHandlerAssertions) CalledTimes(n int) bool

CalledTimes asserts that a particular handler was called X number of times

Jump to

Keyboard shortcuts

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