assertions

package
v3.29.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package assertions contains custom assertions compatible with github.com/smarty/assertions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldBeProperSupersetOfElementsFunc

func ShouldBeProperSupersetOfElementsFunc(actual any, expected ...any) (message string)

ShouldBeProperSupersetOfElementsFunc takes as arguments the actual value, a comparison function and the expected value. If the actual value represents a proper superset of expected value under equality given by the comparison function, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldEqualErrorOrDefinition

func ShouldEqualErrorOrDefinition(actual any, expected ...any) string

ShouldEqualErrorOrDefinition is used to assert that an error equals the given Error or Definition.

func ShouldHaveEmptyDiff

func ShouldHaveEmptyDiff(actual any, expected ...any) (message string)

ShouldHaveEmptyDiff compares the test.Diff of values.

func ShouldHaveParentContext

func ShouldHaveParentContext(actual any, expected ...any) string

ShouldHaveParentContext takes as argument a context.Context and context.Context. If the arguments are valid and the actual context has the expected context as parent, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldHaveParentContextOrEqual

func ShouldHaveParentContextOrEqual(actual any, expected ...any) string

ShouldHaveParentContextOrEqual takes as argument a context.Context and context.Context. If the arguments are valid and the actual context has the expected context as parent or if they are equal, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldHaveSameElementsDeep

func ShouldHaveSameElementsDeep(actual any, expected ...any) (message string)

ShouldHaveSameElementsDeep takes as arguments the actual value and the expected value. If the actual value equals the expected value using test.DiffEqual, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldHaveSameElementsDiff

func ShouldHaveSameElementsDiff(actual any, expected ...any) (message string)

ShouldHaveSameElementsDiff takes as arguments the actual value and the expected value. If the actual value equals the expected value using test.Diff, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldHaveSameElementsEvent

func ShouldHaveSameElementsEvent(actual any, expected ...any) (message string)

ShouldHaveSameElementsEvent takes as arguments the actual value and the expected value. If the actual value equals the expected value using test.EventEqual, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldHaveSameElementsFunc

func ShouldHaveSameElementsFunc(actual any, expected ...any) (message string)

ShouldHaveSameElementsFunc takes as arguments the actual value, a comparison function and the expected value. If the actual value equals the expected value using the comparison function, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldHaveSameErrorDefinitionAs

func ShouldHaveSameErrorDefinitionAs(actual any, expected ...any) string

ShouldHaveSameErrorDefinitionAs is used to assert that an error resembles the given Error or Definition.

func ShouldNotHaveEmptyDiff

func ShouldNotHaveEmptyDiff(actual any, expected ...any) (message string)

ShouldNotHaveEmptyDiff compares the test.Diff of values.

func ShouldNotHaveSameElementsDeep

func ShouldNotHaveSameElementsDeep(actual any, expected ...any) (message string)

ShouldNotHaveSameElementsDeep takes as arguments the actual value and the expected value. If the actual value does not equal the expected value using test.DiffEqual, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldNotHaveSameElementsDiff

func ShouldNotHaveSameElementsDiff(actual any, expected ...any) (message string)

ShouldNotHaveSameElementsDiff takes as arguments the actual value and the expected value. If the actual value does not equal the expected value using test.Diff, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldNotHaveSameElementsEvent

func ShouldNotHaveSameElementsEvent(actual any, expected ...any) (message string)

ShouldNotHaveSameElementsEvent takes as arguments the actual value and the expected value. If the actual value does not equal the expected value using test.EventEqual, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldNotHaveSameElementsFunc

func ShouldNotHaveSameElementsFunc(actual any, expected ...any) (message string)

ShouldNotHaveSameElementsFunc takes as arguments the actual value, a comparison function and the expected value. If the actual value does not equal the expected value using the comparison function, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldNotResemble added in v3.25.0

func ShouldNotResemble(actual any, expected ...any) string

ShouldNotResemble receives exactly two parameters and does an inverse deep equal check (see test.DiffEqual).

func ShouldReceiveEventFunc

func ShouldReceiveEventFunc(actual any, expected ...any) string

ShouldReceiveEventFunc receives 3 parameters. The first being a channel of either events.Event or test.EventPubSubPublishRequest, the second being the equality function of type func(events.Event, events.Event) bool and third being the expected events.Event.

func ShouldReceiveEventResembling

func ShouldReceiveEventResembling(actual any, expected ...any) string

ShouldReceiveEventResembling is like ShouldReceiveEventFunc, but uses same resemblance function as ShouldResembleEvent.

func ShouldReceiveEventsFunc

func ShouldReceiveEventsFunc(actual any, expected ...any) string

ShouldReceiveEventsFunc is like ShouldReceiveEventFunc, but allows for several expected events to be specified. Expected events should be passed as variadic parameters, which can be wrapped any collection of events.Event, that test.WrapRanger can range over.

func ShouldReceiveEventsResembling

func ShouldReceiveEventsResembling(actual any, expected ...any) string

ShouldReceiveEventsResembling is like ShouldReceiveEventsFunc, but uses same resemblance function as ShouldResembleEvent.

func ShouldResemble

func ShouldResemble(actual any, expected ...any) (message string)

ShouldResemble wraps assertions.ShouldResemble and prepends a diff if assertion fails.

func ShouldResembleEvent

func ShouldResembleEvent(actual any, expected ...any) string

ShouldResembleEvent is used to assert that an events.Event resembles another events.Event.

func ShouldResembleEventBuilder added in v3.9.0

func ShouldResembleEventBuilder(actual any, expected ...any) string

ShouldResembleEventBuilder is used to assert that an events.Builder resembles another events.Builder.

func ShouldResembleEventBuilders added in v3.9.0

func ShouldResembleEventBuilders(actual any, expected ...any) string

ShouldResembleEventBuilders is like ShouldResembleEventBuilders, but for events.Builders

func ShouldResembleFields

func ShouldResembleFields(actual any, expected ...any) (message string)

ShouldResembleFields is same as ShouldResemble, but only compares the specified fields for 2 given SetFielders.

Types

This section is empty.

Directories

Path Synopsis
Package should wraps assertions in github.com/smarty/assertions and util/test/assertions.
Package should wraps assertions in github.com/smarty/assertions and util/test/assertions.

Jump to

Keyboard shortcuts

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