Documentation
¶
Index ¶
- func DeepEqual(t require.TestingT, a any, b any)
- func NotProtoEqual(t require.TestingT, a proto.Message, b proto.Message)
- func ProtoElementsMatch(t require.TestingT, a any, b any, msgAndArgs ...any)
- func ProtoEqual(t require.TestingT, a proto.Message, b proto.Message, opts ...Option)
- func ProtoSliceEqual[T proto.Message](t require.TestingT, a []T, b []T)
- type Option
- type ProtoAssertions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProtoElementsMatch ¶
ProtoElementsMatch behaves like require.ElementsMatch except in that it works for protobuf-generated structs. Both arguments must be slices or arrays.
func ProtoEqual ¶
ProtoEqual compares two proto messages for equality using proto semantics. Options can be passed to customize comparison behavior, e.g. protorequire.IgnoreFields to exclude specific fields.
func ProtoSliceEqual ¶
ProtoSliceEqual compares elements in a slice of proto.Message. This is not a method on the suite type because methods cannot have generic parameters and slice casting (say from []historyEvent) to []proto.Message is impossible
Types ¶
type Option ¶
Option configures how proto comparison behaves.
func IgnoreFields ¶
func IgnoreFields(fields ...protoreflect.Name) Option
IgnoreFields returns an Option that ignores the specified fields (by proto name) on the top-level message type when comparing.
type ProtoAssertions ¶
type ProtoAssertions struct {
// contains filtered or unexported fields
}
func New ¶
func New(t require.TestingT) ProtoAssertions
func (ProtoAssertions) DeepEqual ¶
func (x ProtoAssertions) DeepEqual(a any, b any)
func (ProtoAssertions) NotProtoEqual ¶
func (x ProtoAssertions) NotProtoEqual(a proto.Message, b proto.Message)
func (ProtoAssertions) ProtoElementsMatch ¶
func (x ProtoAssertions) ProtoElementsMatch(a any, b any, msgAndArgs ...any)