MCPcopy Create free account
hub / github.com/goadesign/goa / TestProtoBufMessageDefJSONNameOption

Function TestProtoBufMessageDefJSONNameOption

grpc/codegen/protobuf_test.go:184–204  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

182}
183
184func TestProtoBufMessageDefJSONNameOption(t *testing.T) {
185 attr := &expr.AttributeExpr{
186 Type: &expr.Object{
187 &expr.NamedAttributeExpr{
188 Name: "value",
189 Attribute: &expr.AttributeExpr{
190 Type: expr.String,
191 Meta: expr.MetaExpr{
192 "rpc:tag": []string{"1"},
193 "proto:tag:json": []string{"customValue"},
194 },
195 },
196 },
197 },
198 }
199 sd := &ServiceData{Scope: codegen.NewNameScope()}
200 def := protoBufMessageDef(attr, sd)
201 if !strings.Contains(def, `json_name = "customValue"`) {
202 t.Fatalf("expected json_name option, got %q", def)
203 }
204}
205
206func TestProtoBufMessageDefJSONNameOptionOneOf(t *testing.T) {
207 attr := &expr.AttributeExpr{

Callers

nothing calls this directly

Calls 2

NewNameScopeFunction · 0.92
protoBufMessageDefFunction · 0.85

Tested by

no test coverage detected