assertions

package
v0.0.0-...-5352646 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 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 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 ShouldHaveSameElementsFunc

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

ShouldHaveSameElementsFunc takes as arguments the actual value, the expected value and a comparison function. 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 reflect.DeepEqual, 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, the expected value and a comparison function. 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 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

func ShouldResembleEventDefinitionDataClosure

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

func ShouldResembleEventDefinitionDataClosures

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

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