prototest_test.go 872 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2019 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package prototest_test
  5. import (
  6. "fmt"
  7. "testing"
  8. irregularpb "google.golang.org/protobuf/internal/testprotos/irregular"
  9. testpb "google.golang.org/protobuf/internal/testprotos/test"
  10. test3pb "google.golang.org/protobuf/internal/testprotos/test3"
  11. "google.golang.org/protobuf/proto"
  12. "google.golang.org/protobuf/testing/prototest"
  13. )
  14. func Test(t *testing.T) {
  15. for _, m := range []proto.Message{
  16. (*testpb.TestAllTypes)(nil),
  17. (*test3pb.TestAllTypes)(nil),
  18. (*testpb.TestRequired)(nil),
  19. (*testpb.TestWeak)(nil),
  20. (*irregularpb.Message)(nil),
  21. (*testpb.TestAllExtensions)(nil),
  22. } {
  23. t.Run(fmt.Sprintf("%T", m), func(t *testing.T) {
  24. prototest.TestMessage(t, m, prototest.MessageOptions{})
  25. })
  26. }
  27. }