proto: rearrange test messages
Move the test inputs for the wire marshaler and unmarshaler out of
decode_test.go and into a new file. Consolidate some tests for invalid
messages (UTF-8 validation failures, field numbers out of range) into
a single list of invalid messages. Break out the no-enforce-utf8 test
into a separate file, since it is both complicated and conditional on
legacy support.
Change-Id: Ide80fa9d3aec2b6d42a57e6f9265358aa5e661a7
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/211557
Reviewed-by: Joe Tsai <joetsai@google.com>
diff --git a/proto/bench_test.go b/proto/bench_test.go
index 19f9eaa..99693e6 100644
--- a/proto/bench_test.go
+++ b/proto/bench_test.go
@@ -25,7 +25,7 @@
// BenchmarkEncode benchmarks encoding all the test messages.
func BenchmarkEncode(b *testing.B) {
- for _, test := range testProtos {
+ for _, test := range testValidMessages {
for _, want := range test.decodeTo {
v1 := want.(protoV1.Message)
opts := proto.MarshalOptions{AllowPartial: *allowPartial}
@@ -50,7 +50,7 @@
// BenchmarkDecode benchmarks decoding all the test messages.
func BenchmarkDecode(b *testing.B) {
- for _, test := range testProtos {
+ for _, test := range testValidMessages {
for _, want := range test.decodeTo {
opts := proto.UnmarshalOptions{AllowPartial: *allowPartial}
b.Run(fmt.Sprintf("%s (%T)", test.desc, want), func(b *testing.B) {