encoding/protojson, encoding/prototext: remove most explicit registries
Change tests which use private types registries to use the global one.
Except in cases where we want to explicitly test that the private
registry is used, it's simpler to use the global registry.
Change-Id: I998fb463b6beef91c7f5ce2ca2083251ae24d1db
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/199897
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/encoding/prototext/other_test.go b/encoding/prototext/other_test.go
index 3ffa071..0ae4ba6 100644
--- a/encoding/prototext/other_test.go
+++ b/encoding/prototext/other_test.go
@@ -8,8 +8,6 @@
"testing"
"google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/impl"
- pimpl "google.golang.org/protobuf/internal/impl"
"google.golang.org/protobuf/proto"
preg "google.golang.org/protobuf/reflect/protoregistry"
@@ -151,7 +149,7 @@
},
}, {
desc: "Any field without registered type",
- resolver: preg.NewTypes(),
+ resolver: new(preg.Types),
message: func() proto.Message {
m := &pb2.Nested{
OptString: proto.String("embedded inside Any"),
@@ -171,8 +169,7 @@
}
}(),
}, {
- desc: "Any field with registered type",
- resolver: preg.NewTypes(pimpl.Export{}.MessageTypeOf(&pb2.Nested{})),
+ desc: "Any field with registered type",
message: func() *pb2.KnownTypes {
m := &pb2.Nested{
OptString: proto.String("embedded inside Any"),
@@ -193,11 +190,6 @@
}(),
}, {
desc: "Any field containing Any message",
- resolver: func() *preg.Types {
- mt1 := impl.Export{}.MessageTypeOf(&pb2.Nested{})
- mt2 := impl.Export{}.MessageTypeOf(&anypb.Any{})
- return preg.NewTypes(mt1, mt2)
- }(),
message: func() *pb2.KnownTypes {
m1 := &pb2.Nested{
OptString: proto.String("message inside Any of another Any field"),