protobuf-go/cmd/protoc-gen-go/opaque_default_test/opaque_default_test.go
Michael Stapelberg eb7b468655 all: Release the Opaque API
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>
2024-12-11 03:16:51 -08:00

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)
}
}