assertions

package
v3.9.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldBeProperSupersetOfElementsFunc

func ShouldBeProperSupersetOfElementsFunc(actual interface{}, expected ...interface{}) (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 interface{}, expected ...interface{}) string

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

func ShouldHaveEmptyDiff

func ShouldHaveEmptyDiff(actual interface{}, expected ...interface{}) (message string)

ShouldHaveEmptyDiff compares the pretty.Diff of values.

func ShouldHaveParentContext

func ShouldHaveParentContext(actual interface{}, expected ...interface{}) 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 interface{}, expected ...interface{}) 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 ShouldHaveRoute

func ShouldHaveRoute(actual interface{}, expected ...interface{}) (message string)

ShouldHaveRoute takes as argument an *echo.Echo, the method string and path string. If a route is found with the given method and path, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldHaveSameElementsDeep

func ShouldHaveSameElementsDeep(actual interface{}, expected ...interface{}) (message string)

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

func ShouldHaveSameElementsDiff

func ShouldHaveSameElementsDiff(actual interface{}, expected ...interface{}) (message string)

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

func ShouldHaveSameElementsEvent

func ShouldHaveSameElementsEvent(actual interface{}, expected ...interface{}) (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 interface{}, expected ...interface{}) (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 interface{}, expected ...interface{}) string

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

func ShouldNotHaveEmptyDiff

func ShouldNotHaveEmptyDiff(actual interface{}, expected ...interface{}) (message string)

ShouldNotHaveEmptyDiff compares the pretty.Diff of values.

func ShouldNotHaveRoute

func ShouldNotHaveRoute(actual interface{}, expected ...interface{}) (message string)

ShouldNotHaveRoute takes as argument an *echo.Echo, the method string and path string. If no route is found with the given method and path, this function returns an empty string. Otherwise, it returns a string describing the error.

func ShouldNotHaveSameElementsDeep

func ShouldNotHaveSameElementsDeep(actual interface{}, expected ...interface{}) (message string)

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

func ShouldNotHaveSameElementsDiff

func ShouldNotHaveSameElementsDiff(actual interface{}, expected ...interface{}) (message string)

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

func ShouldNotHaveSameElementsEvent

func ShouldNotHaveSameElementsEvent(actual interface{}, expected ...interface{}) (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 interface{}, expected ...interface{}) (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 ShouldReceiveEventFunc

func ShouldReceiveEventFunc(actual interface{}, expected ...interface{}) 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 interface{}, expected ...interface{}) string

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

func ShouldReceiveEventsFunc

func ShouldReceiveEventsFunc(actual interface{}, expected ...interface{}) 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 interface{}, expected ...interface{}) string

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

func ShouldResemble

func ShouldResemble(actual interface{}, expected ...interface{}) (message string)

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

func ShouldResembleEvent

func ShouldResembleEvent(actual interface{}, expected ...interface{}) string

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

func ShouldResembleEventBuilder added in v3.9.0

func ShouldResembleEventBuilder(actual interface{}, expected ...interface{}) string

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

func ShouldResembleEventBuilders added in v3.9.0

func ShouldResembleEventBuilders(actual interface{}, expected ...interface{}) string

ShouldResembleEventBuilders is like ShouldResembleEventBuilders, but for events.Builders

func ShouldResembleFields

func ShouldResembleFields(actual interface{}, expected ...interface{}) (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/smartystreets/assertions and util/test/assertions.
Package should wraps assertions in github.com/smartystreets/assertions and util/test/assertions.

Jump to

Keyboard shortcuts

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