(t *testing.T)
| 182 | } |
| 183 | |
| 184 | func 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 | |
| 206 | func TestProtoBufMessageDefJSONNameOptionOneOf(t *testing.T) { |
| 207 | attr := &expr.AttributeExpr{ |
nothing calls this directly
no test coverage detected