enum_test.go 636 B

1234567891011121314151617181920
  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 impl_test
  5. import (
  6. "testing"
  7. pref "google.golang.org/protobuf/reflect/protoreflect"
  8. testpb "google.golang.org/protobuf/internal/testprotos/test"
  9. )
  10. func TestEnum(t *testing.T) {
  11. et := testpb.ForeignEnum_FOREIGN_FOO.Type()
  12. if got, want := et.New(pref.EnumNumber(testpb.ForeignEnum_FOREIGN_FOO)), pref.Enum(testpb.ForeignEnum_FOREIGN_FOO); got != want {
  13. t.Errorf("testpb.ForeignEnum_FOREIGN_FOO.Type().New() = %[1]T(%[1]v), want %[2]T(%[2]v)", got, want)
  14. }
  15. }