mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-28 00:19:55 +00:00
eb7b468655
For golang/protobuf#1657 Change-Id: I7b2b0c30506706015ce278e6054439c9ad9ef727 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/634815 TryBot-Bypass: Michael Stapelberg <stapelberg@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Damien Neil <dneil@google.com>
22 lines
761 B
Go
22 lines
761 B
Go
// Copyright 2024 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 opaque_default_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
enumopaquepb "google.golang.org/protobuf/internal/testprotos/enums/enums_opaque"
|
|
testopaquepb "google.golang.org/protobuf/internal/testprotos/testeditions/testeditions_opaque"
|
|
)
|
|
|
|
// From the spec: "Proto2 enums use the first syntactic entry in the enum
|
|
// declaration as the default value where it is otherwise unspecified."
|
|
func TestOpaqueEnumDefaults(t *testing.T) {
|
|
m := &testopaquepb.RemoteDefault{}
|
|
if got, want := m.GetDefault(), enumopaquepb.Enum_DEFAULT; got != want {
|
|
t.Errorf("default enum value: got %v, expected %v", got, want)
|
|
}
|
|
}
|