github.com/whiteCcinn/protobuf-go@v1.0.9/internal/impl/enum_test.go (about) 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 5 package impl_test 6 7 import ( 8 "testing" 9 10 "github.com/whiteCcinn/protobuf-go/reflect/protoreflect" 11 12 testpb "github.com/whiteCcinn/protobuf-go/internal/testprotos/test" 13 ) 14 15 func 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 }