(t *testing.T)
| 204 | } |
| 205 | |
| 206 | func TestProtoBufMessageDefJSONNameOptionOneOf(t *testing.T) { |
| 207 | attr := &expr.AttributeExpr{ |
| 208 | Type: &expr.Union{ |
| 209 | TypeName: "Animal", |
| 210 | Values: []*expr.NamedAttributeExpr{ |
| 211 | { |
| 212 | Name: "Cat", |
| 213 | Attribute: &expr.AttributeExpr{ |
| 214 | Type: expr.String, |
| 215 | Meta: expr.MetaExpr{ |
| 216 | "rpc:tag": []string{"1"}, |
| 217 | "proto:tag:json": []string{"cat"}, |
| 218 | }, |
| 219 | }, |
| 220 | }, |
| 221 | }, |
| 222 | }, |
| 223 | } |
| 224 | sd := &ServiceData{Scope: codegen.NewNameScope()} |
| 225 | def := protoBufMessageDef(attr, sd) |
| 226 | if !strings.Contains(def, `json_name = "cat"`) { |
| 227 | t.Fatalf("expected json_name option in oneof, got %q", def) |
| 228 | } |
| 229 | } |
nothing calls this directly
no test coverage detected