(t *testing.T)
| 456 | } |
| 457 | |
| 458 | func TestTypesOnlyDifferByEnum(t *testing.T) { |
| 459 | root := codegen.RunDSL(t, dsls.StringEnumBodyDSL()) |
| 460 | |
| 461 | bodies, types := buildBodyTypes(root.API, root.Types, root.ResultTypes) |
| 462 | |
| 463 | svc1, ok := bodies["svc_enum_1"] |
| 464 | if !ok { |
| 465 | t.Errorf("bodies does not contain details for service %q", "svc_enum_1") |
| 466 | return |
| 467 | } |
| 468 | svc2, ok := bodies["svc_enum_2"] |
| 469 | if !ok { |
| 470 | t.Errorf("bodies does not contain details for service %q", "svc_enum_2") |
| 471 | return |
| 472 | } |
| 473 | |
| 474 | svc1MethodRB := svc1["method_enum"].RequestBody.Ref |
| 475 | svc2MethodRB := svc2["method_enum"].RequestBody.Ref |
| 476 | |
| 477 | if svc1MethodRB == svc2MethodRB { |
| 478 | t.Errorf("expected different refs, got %q", svc1MethodRB) |
| 479 | |
| 480 | name := nameFromRef(svc1MethodRB) |
| 481 | derefed := types[name] |
| 482 | jsoned, _ := json.Marshal(derefed) |
| 483 | t.Errorf("shared referenced type (%s) was: %v", name, string(jsoned)) |
| 484 | return |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | func TestHashAttribute(t *testing.T) { |
| 489 | type ( |
nothing calls this directly
no test coverage detected