...
1
2
3
4
5 package main
6
7 import (
8 "testing"
9
10 "google.golang.org/protobuf/internal/filedesc"
11 "google.golang.org/protobuf/reflect/protoreflect"
12 "google.golang.org/protobuf/reflect/protoregistry"
13 )
14
15 func TestRegistry(t *testing.T) {
16 var hasFiles bool
17 protoregistry.GlobalFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool {
18 if fd.(*filedesc.File).L2 != nil {
19 t.Errorf("file %q eagerly went through lazy initialization", fd.Path())
20 }
21 hasFiles = true
22 return true
23 })
24 if !hasFiles {
25 t.Errorf("protoregistry.GlobalFiles is empty")
26 }
27 }
28
View as plain text