p

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package p defines the built-in predicates for go-testpredicate

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(p predicate.T) predicate.T

All tests if a sub-predicate passes for all elements of an array or slice

func AllKeys

func AllKeys(p predicate.T) predicate.T

AllKeys tests if a sub-predicate passes for all keys of a map

func AllValues

func AllValues(p predicate.T) predicate.T

AllValues tests if a sub-predicate passes for all values of a map

func Any

func Any(p predicate.T) predicate.T

Any tests if a sub-predicate passes for any elements of an array or slice

func AnyKey

func AnyKey(p predicate.T) predicate.T

AnyKey tests if a sub-predicate passes for any key of a map

func AnyValue

func AnyValue(p predicate.T) predicate.T

AnyValue tests if a sub-predicate passes for any value of a map

func Capacity

func Capacity(p predicate.T) predicate.T

Capacity returns a predicate that checks if the capacity of a value matches the nested predicate. Applies to values of tpye Array, Slice or Channel.

func CloseTo

func CloseTo(rhs interface{}, tolerance float64) predicate.T

CloseTo return a predicate to check if a value is almost equal to the reference value, within the specified tolerance. Value and reference value can numeric, or slice or array of numeric values, of equal size

func Contains

func Contains(rhs interface{}) predicate.T

Contains returns a predicate that checks

func EndsWith

func EndsWith(rhs interface{}) predicate.T

EndsWith returns a predicate that checks

func Eq

func Eq(rhs interface{}) predicate.T

Eq is a shorter alias for IsEqualTo

func Ge

func Ge(rhs interface{}) predicate.T

Ge is a shorter alias for IsGreaterOrEqualTo

func GreaterOrEqualTo

func GreaterOrEqualTo(rhs interface{}) predicate.T

GreaterOrEqualTo returns a predicate that check if a value is greater or equal to the specified value

func GreaterThan

func GreaterThan(rhs interface{}) predicate.T

GreaterThan returns a predicate that check if a value is strictly greater than the specified value

func Gt

func Gt(rhs interface{}) predicate.T

Gt is a shorter alias for IsGreaterThan

func IsDisjointSetFrom

func IsDisjointSetFrom(rhs interface{}) predicate.T

IsDisjointSetFrom returns a predicate that checks

func IsEmpty

func IsEmpty() predicate.T

IsEmpty returns a predicate that checks if a value is nil

func IsEqualSet

func IsEqualSet(rhs interface{}) predicate.T

IsEqualSet returns a predicate that checks

func IsEqualTo

func IsEqualTo(rhs interface{}) predicate.T

IsEqualTo tests if a value is comparable and equal to the reference value

func IsError

func IsError(expectedErr error) predicate.T

IsError tests if an error value matches a specific error, using errros.Is() to support go v1.13 error wrapping

func IsFalse

func IsFalse() predicate.T

IsFalse tests if a value is false

func IsNil

func IsNil() predicate.T

IsNil tests if a value is nil

func IsNoError

func IsNoError() predicate.T

IsNoError tests if an error value is nil

func IsNotEmpty

func IsNotEmpty() predicate.T

IsNotEmpty returns a predicate that checks if a value is not nil

func IsNotEqualTo

func IsNotEqualTo(rhs interface{}) predicate.T

IsNotEqualTo tests if a value is comparable but different than the reference value

func IsNotNil

func IsNotNil() predicate.T

IsNotNil tests if a value is not nil

func IsSubsetOf

func IsSubsetOf(rhs interface{}) predicate.T

IsSubsetOf returns a predicate that checks

func IsSupersetOf

func IsSupersetOf(rhs interface{}) predicate.T

IsSupersetOf returns a predicate that checks

func IsTrue

func IsTrue() predicate.T

IsTrue tests if a value is true

func Le

func Le(rhs interface{}) predicate.T

Le is a shorter alias for IsLessOrEqualTo

func Length

func Length(p predicate.T) predicate.T

Length returns a predicate that checks if the length of a value matches the nested predicate. Applies to values of tpye String, Array, Slice, Map, or Channel.

func LessOrEqualTo

func LessOrEqualTo(rhs interface{}) predicate.T

LessOrEqualTo returns a predicate that check if a value is less or equal to the specified value

func LessThan

func LessThan(rhs interface{}) predicate.T

LessThan returns a predicate that check if a value is strictly less than the specified value

func Lt

func Lt(rhs interface{}) predicate.T

Lt is a shorter alias for IsLessThan

func MapKeys

func MapKeys(p predicate.T) predicate.T

MapKeys applies the sub-predicate to the keys of a map

func MapValues

func MapValues(p predicate.T) predicate.T

MapValues applies the sub-predicate to the values of a map

func Matches

func Matches(re string) predicate.T

Matches returns a predicate that checks if a string matches a regular expression

func Ne

func Ne(rhs interface{}) predicate.T

Ne is a shorter alias for IsNotEqualTo

func Panics

func Panics() predicate.T

Panics returns a predicate that evaluates value as a callable function and expects it to panic.

func PanicsAndResult

func PanicsAndResult(p predicate.T) predicate.T

PanicsAndResult returns a predicate that evaluates value as a callable function, expect it to panic, and evaluate the panic value against the nested predicate

func StartsWith

func StartsWith(rhs interface{}) predicate.T

StartsWith returns a predicate that checks

func ToLower

func ToLower(p predicate.T) predicate.T

ToLower returns a predicate that checks if the lowercase version of a string passes the nested predicate

func ToString

func ToString(p predicate.T) predicate.T

ToString returns a predicate that checks if a value converted to a string passes the nested predicate. Value is conversted using fmt.Sprintf("%v", ...)

func ToUpper

func ToUpper(p predicate.T) predicate.T

ToUpper returns a predicate that checks if the uppercase version of a string passes the nested predicate

Types

This section is empty.

Jump to

Keyboard shortcuts

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