testing/prototest: add package testing message implementations
The prototest package takes a message and exercises its implementation
of the protoreflect.Message interface in a variety of ways.
Change-Id: I4c150d1f1a6c41048f7e7f0d77efa4440ae8db0d
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/174577
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/testing/prototest/prototest_test.go b/testing/prototest/prototest_test.go
new file mode 100644
index 0000000..6a3b1ab
--- /dev/null
+++ b/testing/prototest/prototest_test.go
@@ -0,0 +1,27 @@
+// 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 prototest_test
+
+import (
+ "fmt"
+ "testing"
+
+ testpb "github.com/golang/protobuf/v2/internal/testprotos/test"
+ test3pb "github.com/golang/protobuf/v2/internal/testprotos/test3"
+ "github.com/golang/protobuf/v2/proto"
+ "github.com/golang/protobuf/v2/testing/prototest"
+)
+
+func Test(t *testing.T) {
+ for _, m := range []proto.Message{
+ (*testpb.TestAllTypes)(nil),
+ (*test3pb.TestAllTypes)(nil),
+ (*testpb.TestRequired)(nil),
+ } {
+ t.Run(fmt.Sprintf("%T", m), func(t *testing.T) {
+ prototest.TestMessage(t, m)
+ })
+ }
+}