-- import "github.com/expectto/be/be_reflected"
Package be_reflected provides Be matchers that use reflection, enabling expressive assertions on values' reflect kinds and types. It consists of several "core" matchers e.g. AsKind / AssignableTo / Implementing And many other matchers that are made on-top on core ones. E.g. AsFunc / AsString / AsNumber /
func AsBytes() types.BeMatcher
AsBytes succeeds if actual is assignable to a slice of bytes ([]byte).
func AsChan() types.BeMatcher
AsChan succeeds if actual is of kind reflect.Chan.
func AsFinalPointer() types.BeMatcher
AsFinalPointer succeeds if the actual value is a final pointer, meaning it's a pointer to a non-pointer type.
func AsFloat() types.BeMatcher
AsFloat succeeds if actual is a numeric value that represents a floating-point value.
func AsFloatString() types.BeMatcher
AsFloatString succeeds if actual is a string that can be parsed into a valid floating-point value.
func AsFunc() types.BeMatcher
AsFunc succeeds if actual is of kind reflect.Func.
func AsInteger() types.BeMatcher
AsInteger succeeds if actual is a numeric value that represents an integer (from reflect.Int up to reflect.Uint64).
func AsIntegerString() types.BeMatcher
AsIntegerString succeeds if actual is a string that can be parsed into a valid integer value.
func AsKind(args ...any) types.BeMatcher
AsKind succeeds if actual is assignable to any of the specified kinds or matches the provided matchers.
func AsMap() types.BeMatcher
AsMap succeeds if actual is of kind reflect.Map.
func AsNumber() types.BeMatcher
AsNumber succeeds if actual is a numeric value, supporting various integer kinds: reflect.Int, ... reflect.Int64, and floating-point kinds: reflect.Float32, reflect.Float64
func AsNumericString() types.BeMatcher
AsNumericString succeeds if actual is a string that can be parsed into a valid numeric value.
func AsObject() types.BeMatcher
AsObject is more specific than AsMap. It checks if the given actual
value is a
map with string keys and values of any type. This is particularly useful in the
context of BeJson matcher, where the term 'Object' aligns with JSON notation.
func AsObjects() types.BeMatcher
func AsPointer() types.BeMatcher
AsPointer succeeds if the actual value is a pointer.
func AsPointerToMap() types.BeMatcher
AsPointerToMap succeeds if actual is a pointer to a map.
func AsPointerToObject() types.BeMatcher
AsPointerToObject succeeds if actual is a pointer to a value that matches AsObject after applying dereference.
func AsPointerToSlice() types.BeMatcher
AsPointerToSlice succeeds if actual is a pointer to a slice.
func AsPointerToStruct() types.BeMatcher
AsPointerToStruct succeeds if actual is a pointer to a struct.
func AsReader() types.BeMatcher
AsReader succeeds if actual implements the io.Reader interface.
func AsSlice() types.BeMatcher
AsSlice succeeds if actual is of kind reflect.Slice.
func AsSliceOf[T any]() types.BeMatcher
AsSliceOf succeeds if actual is of kind reflect.Slice and each element of the slice is assignable to the specified type T.
func AsString() types.BeMatcher
AsString succeeds if actual is of kind reflect.String.
func AsStringer() types.BeMatcher
AsStringer succeeds if actual implements the fmt.Stringer interface.
func AsStruct() types.BeMatcher
AsStruct succeeds if actual is of kind reflect.Struct.
func AssignableTo[T any]() types.BeMatcher
AssignableTo succeeds if actual is assignable to the specified type T.
func Implementing[T any]() types.BeMatcher
Implementing succeeds if actual implements the specified interface type T.