mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-28 00:19:55 +00:00
3b65992c65
These methods are difficult or impossible to use correctly; types created by the dynamicpb package, for example, all have the same GoType. Fixes golang/protobuf#938 Change-Id: I33d4ef381579ff18569b11df501d0ba7f38a6b5c Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/199060 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
21 lines
636 B
Go
21 lines
636 B
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package impl_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
pref "google.golang.org/protobuf/reflect/protoreflect"
|
|
|
|
testpb "google.golang.org/protobuf/internal/testprotos/test"
|
|
)
|
|
|
|
func TestEnum(t *testing.T) {
|
|
et := testpb.ForeignEnum_FOREIGN_FOO.Type()
|
|
if got, want := et.New(pref.EnumNumber(testpb.ForeignEnum_FOREIGN_FOO)), pref.Enum(testpb.ForeignEnum_FOREIGN_FOO); got != want {
|
|
t.Errorf("testpb.ForeignEnum_FOREIGN_FOO.Type().New() = %[1]T(%[1]v), want %[2]T(%[2]v)", got, want)
|
|
}
|
|
}
|