MCPcopy
hub / github.com/golang/protobuf / TestRegistry

Function TestRegistry

proto/registry_test.go:17–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestRegistry(t *testing.T) {
18 file := new(descpb.DescriptorProto).ProtoReflect().Descriptor().ParentFile()
19 path := file.Path()
20 pkg := file.Package()
21 if got := proto.FileDescriptor(path); len(got) == 0 {
22 t.Errorf("FileDescriptor(%q) = empty, want non-empty", path)
23 }
24
25 name := protoreflect.FullName(pkg + ".FieldDescriptorProto_Label")
26 if got := proto.EnumValueMap(string(name)); len(got) == 0 {
27 t.Errorf("EnumValueMap(%q) = empty, want non-empty", name)
28 }
29
30 msg := new(descpb.EnumDescriptorProto_EnumReservedRange)
31 name = msg.ProtoReflect().Descriptor().FullName()
32 wantType := reflect.TypeOf(msg)
33 gotType := proto.MessageType(string(name))
34 if gotType != wantType {
35 t.Errorf("MessageType(%q) = %v, want %v", name, gotType, wantType)
36 }
37}

Callers

nothing calls this directly

Calls 5

FileDescriptorFunction · 0.92
EnumValueMapFunction · 0.92
MessageTypeFunction · 0.92
ProtoReflectMethod · 0.80
DescriptorMethod · 0.65

Tested by

no test coverage detected