Damien Neil | 95539ea | 2019-08-30 10:20:26 -0700 | [diff] [blame] | 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 | |
Joe Tsai | cbdefb1 | 2019-09-16 09:57:27 -0700 | [diff] [blame] | 5 | package impl_test |
Damien Neil | 95539ea | 2019-08-30 10:20:26 -0700 | [diff] [blame] | 6 | |
| 7 | import ( |
| 8 | "reflect" |
| 9 | "testing" |
| 10 | |
Damien Neil | 95539ea | 2019-08-30 10:20:26 -0700 | [diff] [blame] | 11 | pref "google.golang.org/protobuf/reflect/protoreflect" |
Joe Tsai | cbdefb1 | 2019-09-16 09:57:27 -0700 | [diff] [blame] | 12 | |
| 13 | testpb "google.golang.org/protobuf/internal/testprotos/test" |
Damien Neil | 95539ea | 2019-08-30 10:20:26 -0700 | [diff] [blame] | 14 | ) |
| 15 | |
| 16 | func TestEnum(t *testing.T) { |
| 17 | et := testpb.ForeignEnum_FOREIGN_FOO.Type() |
| 18 | if got, want := et.GoType(), reflect.TypeOf(testpb.ForeignEnum_FOREIGN_FOO); got != want { |
| 19 | t.Errorf("testpb.ForeignEnum_FOREIGN_FOO.Type().GoType() = %v, want %v", got, want) |
| 20 | } |
| 21 | if got, want := et.New(pref.EnumNumber(testpb.ForeignEnum_FOREIGN_FOO)), pref.Enum(testpb.ForeignEnum_FOREIGN_FOO); got != want { |
| 22 | t.Errorf("testpb.ForeignEnum_FOREIGN_FOO.Type().New() = %[1]T(%[1]v), want %[2]T(%[2]v)", got, want) |
| 23 | } |
| 24 | } |