testutils

package
v2.0.0-...-98cc131 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calling

func Calling[T any](o T, err error) result[T]

func Close

func Close(c io.Closer, msg ...interface{})

func Defer

func Defer(f func() error, msg ...interface{})

func DeferWithOffset

func DeferWithOffset(o int, f func() error, msg ...interface{})

func ExpectError

func ExpectError(values ...interface{}) types.Assertion

func Must

func Must[T any](o T, err error) T

func Must2

func Must2[T any, V any](a T, b V, err error) (T, V)

func MustBeNonNil

func MustBeNonNil[T any](o T) T

func MustBeSuccessful

func MustBeSuccessful(err error)

func MustBeSuccessfulWithOffset

func MustBeSuccessfulWithOffset(offset int, err error)

func MustFailWithMessage

func MustFailWithMessage(err error, msg string)

func MustWithOffset

func MustWithOffset[T any](offset int, res result[T]) T

func R

func R[T any](o T, err error) result[T]

func StringEqualTrimmedWithContext

func StringEqualTrimmedWithContext(expected string, subst ...map[string]string) types.GomegaMatcher

StringEqualTrimmedWithContext compares two trimmed strings and provides the complete actual value as error context. If value mappings are given, the expected string is evaluated by envsubst, first. It is an error for actual to be nil. Use BeNil() instead.

func StringEqualWithContext

func StringEqualWithContext(expected string, subst ...map[string]string) types.GomegaMatcher

StringEqualWithContext compares two strings and provides the complete actual value as error context. If value mappings are given, the expected string is evaluated by envsubst, first. It is an error for actual to be nil. Use BeNil() instead.

Types

type StringEqualMatcher

type StringEqualMatcher struct {
	Expected string
	Trim     bool
}

func (*StringEqualMatcher) FailureMessage

func (matcher *StringEqualMatcher) FailureMessage(actual interface{}) (message string)

func (*StringEqualMatcher) Match

func (matcher *StringEqualMatcher) Match(actual interface{}) (success bool, err error)

func (*StringEqualMatcher) NegatedFailureMessage

func (matcher *StringEqualMatcher) NegatedFailureMessage(actual interface{}) (message string)

Jump to

Keyboard shortcuts

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