encoding/textpb: switch tests to use V2 generated messages
Change-Id: I817568aec5fbf053c3566b311e92b79aff1caf7e
Reviewed-on: https://go-review.googlesource.com/c/154177
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/encoding/textpb/encode_test.go b/encoding/textpb/encode_test.go
index 7c9a912..55f3e77 100644
--- a/encoding/textpb/encode_test.go
+++ b/encoding/textpb/encode_test.go
@@ -9,11 +9,9 @@
"strings"
"testing"
- protoV1 "github.com/golang/protobuf/proto"
"github.com/golang/protobuf/v2/encoding/textpb"
"github.com/golang/protobuf/v2/internal/detrand"
"github.com/golang/protobuf/v2/internal/encoding/pack"
- "github.com/golang/protobuf/v2/internal/impl"
"github.com/golang/protobuf/v2/internal/scalar"
"github.com/golang/protobuf/v2/proto"
"github.com/google/go-cmp/cmp"
@@ -32,10 +30,6 @@
detrand.Disable()
}
-func M(m interface{}) proto.Message {
- return impl.Export{}.MessageOf(m).Interface()
-}
-
// splitLines is a cmpopts.Option for comparing strings with line breaks.
var splitLines = cmpopts.AcyclicTransformer("SplitLines", func(s string) []string {
return strings.Split(s, "\n")
@@ -56,7 +50,7 @@
func TestMarshal(t *testing.T) {
tests := []struct {
desc string
- input protoV1.Message
+ input proto.Message
want string
wantErr bool
}{{
@@ -806,7 +800,7 @@
tt := tt
t.Run(tt.desc, func(t *testing.T) {
t.Parallel()
- b, err := textpb.Marshal(M(tt.input))
+ b, err := textpb.Marshal(tt.input)
if err != nil && !tt.wantErr {
t.Errorf("Marshal() returned error: %v\n\n", err)
}