...

Source file src/google.golang.org/protobuf/internal/impl/enum_test.go

Documentation: google.golang.org/protobuf/internal/impl

     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  	"google.golang.org/protobuf/reflect/protoreflect"
    11  
    12  	testpb "google.golang.org/protobuf/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  }
    21  

View as plain text