protorequire

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepEqual

func DeepEqual(t require.TestingT, a any, b any)

func NotProtoEqual

func NotProtoEqual(t require.TestingT, a proto.Message, b proto.Message)

func ProtoElementsMatch

func ProtoElementsMatch(t require.TestingT, a any, b any, msgAndArgs ...any)

ProtoElementsMatch behaves like require.ElementsMatch except in that it works for protobuf-generated structs. Both arguments must be slices or arrays.

func ProtoEqual

func ProtoEqual(t require.TestingT, a proto.Message, b proto.Message, opts ...Option)

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

func ProtoSliceEqual[T proto.Message](t require.TestingT, a []T, b []T)

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

type Option func(msg proto.Message, cfg *config)

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 (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)

func (ProtoAssertions) ProtoEqual

func (x ProtoAssertions) ProtoEqual(a proto.Message, b proto.Message, opts ...Option)

Jump to

Keyboard shortcuts

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