xref: /aosp_15_r20/external/golang-protobuf/internal/impl/enum_test.go (revision 1c12ee1efe575feb122dbf939ff15148a3b3e8f2)
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
5package impl_test
6
7import (
8	"testing"
9
10	"google.golang.org/protobuf/reflect/protoreflect"
11
12	testpb "google.golang.org/protobuf/internal/testprotos/test"
13)
14
15func TestEnum(t *testing.T) {
16	et := testpb.ForeignEnum_FOREIGN_FOO.Type()
17	if got, want := et.New(protoreflect.EnumNumber(testpb.ForeignEnum_FOREIGN_FOO)), protoreflect.Enum(testpb.ForeignEnum_FOREIGN_FOO); got != want {
18		t.Errorf("testpb.ForeignEnum_FOREIGN_FOO.Type().New() = %[1]T(%[1]v), want %[2]T(%[2]v)", got, want)
19	}
20}
21