Documentation
¶
Overview ¶
Package knownvalue contains the known value interface, and types implementing the known value interface.
Index ¶
- func Bool(value bool) boolValue
- func BoolFunc(fn func(v bool) error) boolFunc
- func Float32Exact(value float32) float32Exact
- func Float32Func(fn func(v float32) error) float32Func
- func Float64Exact(value float64) float64Exact
- func Float64Func(fn func(v float64) error) float64Func
- func Int32Exact(value int32) int32Exact
- func Int32Func(fn func(v int32) error) int32Func
- func Int64Exact(value int64) int64Exact
- func Int64Func(fn func(v int64) error) int64Func
- func ListExact(value []Check) listExact
- func ListPartial(value map[int]Check) listPartial
- func ListSizeExact(size int) listSizeExact
- func MapExact(value map[string]Check) mapExact
- func MapPartial(value map[string]Check) mapPartial
- func MapSizeExact(size int) mapSizeExact
- func NotNull() notNull
- func Null() null
- func NumberExact(value *big.Float) numberExact
- func NumberFunc(fn func(v *big.Float) error) numberFunc
- func ObjectExact(value map[string]Check) objectExact
- func ObjectPartial(value map[string]Check) objectPartial
- func SetExact(value []Check) setExact
- func SetPartial(value []Check) setPartial
- func SetSizeExact(size int) setSizeExact
- func StringExact(value string) stringExact
- func StringFunc(fn func(v string) error) stringFunc
- func StringRegexp(regex *regexp.Regexp) stringRegexp
- func TupleExact(value []Check) tupleExact
- func TuplePartial(value map[int]Check) tuplePartial
- func TupleSizeExact(size int) tupleSizeExact
- type Check
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
func Bool(value bool) boolValue
Bool returns a Check for asserting equality between the supplied bool and the value passed to the CheckValue method.
func BoolFunc ¶ added in v1.12.0
BoolFunc returns a Check for passing the bool value in state to the provided check function
func Float32Exact ¶ added in v1.9.0
func Float32Exact(value float32) float32Exact
Float32Exact returns a Check for asserting equality between the supplied float32 and the value passed to the CheckValue method.
func Float32Func ¶ added in v1.12.0
Float32Func returns a Check for passing the float32 value in state to the provided check function
func Float64Exact ¶
func Float64Exact(value float64) float64Exact
Float64Exact returns a Check for asserting equality between the supplied float64 and the value passed to the CheckValue method.
func Float64Func ¶ added in v1.12.0
Float64Func returns a Check for passing the float64 value in state to the provided check function
func Int32Exact ¶ added in v1.9.0
func Int32Exact(value int32) int32Exact
Int32Exact returns a Check for asserting equality between the supplied int32 and the value passed to the CheckValue method.
func Int32Func ¶ added in v1.12.0
Int32Func returns a Check for passing the int32 value in state to the provided check function
func Int64Exact ¶
func Int64Exact(value int64) int64Exact
Int64Exact returns a Check for asserting equality between the supplied int64 and the value passed to the CheckValue method.
func Int64Func ¶ added in v1.12.0
Int64Func returns a Check for passing the int64 value in state to the provided check function
func ListExact ¶
func ListExact(value []Check) listExact
ListExact returns a Check for asserting equality between the supplied []Check and the value passed to the CheckValue method. This is an order-dependent check.
func ListPartial ¶
ListPartial returns a Check for asserting partial equality between the supplied map[int]Check and the value passed to the CheckValue method. The map keys represent the zero-ordered element indices within the list that is being checked. Only the elements at the indices defined within the supplied map[int]Check are checked.
func ListSizeExact ¶
func ListSizeExact(size int) listSizeExact
ListSizeExact returns a Check for asserting that a list has size elements.
func MapExact ¶
MapExact returns a Check for asserting equality between the supplied map[string]Check and the value passed to the CheckValue method.
func MapPartial ¶
MapPartial returns a Check for asserting partial equality between the supplied map[string]Check and the value passed to the CheckValue method. Only the elements at the map keys defined within the supplied map[string]Check are checked.
func MapSizeExact ¶
func MapSizeExact(size int) mapSizeExact
MapSizeExact returns a Check for asserting that a map has size elements.
func NotNull ¶
func NotNull() notNull
NotNull returns a Check for asserting the value passed to the CheckValue method is not nil.
func Null ¶
func Null() null
Null returns a Check for asserting the value passed to the CheckValue method is nil.
func NumberExact ¶
NumberExact returns a Check for asserting equality between the supplied *big.Float and the value passed to the CheckValue method. The CheckValue method uses 512-bit precision to perform this assertion.
func NumberFunc ¶ added in v1.12.0
NumberFunc returns a Check for passing the int64 value in state to the provided check function
func ObjectExact ¶
ObjectExact returns a Check for asserting equality between the supplied map[string]Check and the value passed to the CheckValue method. The map keys represent object attribute names.
func ObjectPartial ¶
ObjectPartial returns a Check for asserting partial equality between the supplied map[string]Check and the value passed to the CheckValue method. The map keys represent object attribute names. Only the object attributes defined by the map keys within the supplied map[string]Check are checked.
func SetExact ¶
func SetExact(value []Check) setExact
SetExact returns a Check for asserting equality between the supplied []Check and the value passed to the CheckValue method. This is an order-independent check.
func SetPartial ¶
func SetPartial(value []Check) setPartial
SetPartial returns a Check for asserting partial equality between the supplied []Check and the value passed to the CheckValue method. Only the elements defined within the supplied []Check are checked. This is an order-independent check.
func SetSizeExact ¶
func SetSizeExact(size int) setSizeExact
SetSizeExact returns a Check for asserting that a set has size elements.
func StringExact ¶
func StringExact(value string) stringExact
StringExact returns a Check for asserting equality between the supplied string and a value passed to the CheckValue method.
func StringFunc ¶ added in v1.12.0
StringFunc returns a Check for passing the string value in state to the provided check function
func StringRegexp ¶
StringRegexp returns a Check for asserting equality between the supplied regular expression and a value passed to the CheckValue method.
func TupleExact ¶ added in v1.8.0
func TupleExact(value []Check) tupleExact
TupleExact returns a Check for asserting equality between the supplied []Check and the value passed to the CheckValue method. This is an order-dependent check.
func TuplePartial ¶ added in v1.8.0
TuplePartial returns a Check for asserting partial equality between the supplied map[int]Check and the value passed to the CheckValue method. The map keys represent the zero-ordered element indices within the tuple that is being checked. Only the elements at the indices defined within the supplied map[int]Check are checked.
func TupleSizeExact ¶ added in v1.8.0
func TupleSizeExact(size int) tupleSizeExact
TupleSizeExact returns a Check for asserting that a tuple has size elements.
Types ¶
type Check ¶
type Check interface { // CheckValue should assert the given known value against any expectations. Use the error // return to signal unexpected values or implementation errors. CheckValue(value any) error // String should return a string representation of the type and value. String() string }
Check defines an interface that is implemented to determine whether type and value match. Individual implementations determine how the match is performed (e.g., exact match, partial match).
Source Files
¶
- bool.go
- bool_func.go
- check.go
- doc.go
- float32.go
- float32_func.go
- float64.go
- float64_func.go
- int32.go
- int32_func.go
- int64.go
- int64_func.go
- list.go
- list_partial.go
- list_size.go
- map.go
- map_partial.go
- map_size.go
- not_null.go
- null.go
- number.go
- number_func.go
- object.go
- object_partial.go
- set.go
- set_partial.go
- set_size.go
- string.go
- string_func.go
- string_regexp.go
- tuple.go
- tuple_partial.go
- tuple_size.go