(t *testing.T)
| 574 | } |
| 575 | |
| 576 | func TestAttributeExprIsRequired(t *testing.T) { |
| 577 | cases := map[string]struct { |
| 578 | attName string |
| 579 | expected bool |
| 580 | }{ |
| 581 | "required": { |
| 582 | attName: "foo", |
| 583 | expected: true, |
| 584 | }, |
| 585 | "not required": { |
| 586 | attName: "bar", |
| 587 | expected: false, |
| 588 | }, |
| 589 | } |
| 590 | |
| 591 | for k, tc := range cases { |
| 592 | attribute := AttributeExpr{ |
| 593 | Type: &UserTypeExpr{ |
| 594 | AttributeExpr: &AttributeExpr{ |
| 595 | Validation: &ValidationExpr{ |
| 596 | Required: []string{"foo"}, |
| 597 | }, |
| 598 | }, |
| 599 | }, |
| 600 | } |
| 601 | if actual := attribute.IsRequired(tc.attName); tc.expected != actual { |
| 602 | t.Errorf("%s: got %#v, expected %#v", k, actual, tc.expected) |
| 603 | } |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | func TestAttributeExprIsRequiredNoDefault(t *testing.T) { |
| 608 | cases := map[string]struct { |
nothing calls this directly
no test coverage detected