12345678910111213141516171819202122232425262728 |
- // Copyright 2019 The Go Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style
- // license that can be found in the LICENSE file.
- package proto_test
- import (
- "reflect"
- "testing"
- "github.com/golang/protobuf/proto"
- "google.golang.org/protobuf/types/descriptorpb"
- )
- func TestRegistry(t *testing.T) {
- if got := proto.FileDescriptor("google/protobuf/descriptor.proto"); len(got) == 0 {
- t.Errorf(`FileDescriptor("google/protobuf/descriptor.proto") = empty, want non-empty`)
- }
- if got := proto.EnumValueMap("google.protobuf.FieldDescriptorProto_Label"); len(got) == 0 {
- t.Errorf(`EnumValueMap("google.protobuf.FieldDescriptorProto_Label") = empty, want non-empty`)
- }
- wantType := reflect.TypeOf(new(descriptorpb.EnumDescriptorProto_EnumReservedRange))
- gotType := proto.MessageType("google.protobuf.EnumDescriptorProto.EnumReservedRange")
- if gotType != wantType {
- t.Errorf(`MessageType("google.protobuf.EnumDescriptorProto.EnumReservedRange") = %v, want %v`, gotType, wantType)
- }
- }
|