...

Package prototest

import "google.golang.org/protobuf/testing/prototest"
Overview
Index

Overview ▾

Package prototest exercises protobuf reflection.

type Enum

Enum tests an protoreflect.EnumType implementation.

type Enum struct{}

func (Enum) Test

func (test Enum) Test(t testing.TB, et protoreflect.EnumType)

type Message

Message tests a message implementation.

type Message struct {
    // Resolver is used to determine the list of extension fields to test with.
    // If nil, this defaults to using protoregistry.GlobalTypes.
    Resolver interface {
        FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
        FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
        RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool)
    }
}

func (Message) Test

func (test Message) Test(t testing.TB, mt protoreflect.MessageType)

Test performs tests on a protoreflect.MessageType implementation.