(t *testing.T)
| 19 | var _ hcl.Expression = mockExprVariable("") |
| 20 | |
| 21 | func TestMockBodyPartialContent(t *testing.T) { |
| 22 | tests := map[string]struct { |
| 23 | In *hcl.BodyContent |
| 24 | Schema *hcl.BodySchema |
| 25 | Want *hcl.BodyContent |
| 26 | Remain *hcl.BodyContent |
| 27 | DiagCount int |
| 28 | }{ |
| 29 | "empty": { |
| 30 | &hcl.BodyContent{}, |
| 31 | &hcl.BodySchema{}, |
| 32 | &hcl.BodyContent{ |
| 33 | Attributes: hcl.Attributes{}, |
| 34 | Blocks: hcl.Blocks{}, |
| 35 | }, |
| 36 | &hcl.BodyContent{ |
| 37 | Attributes: hcl.Attributes{}, |
| 38 | Blocks: hcl.Blocks{}, |
| 39 | }, |
| 40 | 0, |
| 41 | }, |
| 42 | "attribute requested": { |
| 43 | &hcl.BodyContent{ |
| 44 | Attributes: MockAttrs(map[string]hcl.Expression{ |
| 45 | "name": MockExprLiteral(cty.StringVal("Ermintrude")), |
| 46 | }), |
| 47 | }, |
| 48 | &hcl.BodySchema{ |
| 49 | Attributes: []hcl.AttributeSchema{ |
| 50 | { |
| 51 | Name: "name", |
| 52 | }, |
| 53 | }, |
| 54 | }, |
| 55 | &hcl.BodyContent{ |
| 56 | Attributes: MockAttrs(map[string]hcl.Expression{ |
| 57 | "name": MockExprLiteral(cty.StringVal("Ermintrude")), |
| 58 | }), |
| 59 | Blocks: hcl.Blocks{}, |
| 60 | }, |
| 61 | &hcl.BodyContent{ |
| 62 | Attributes: hcl.Attributes{}, |
| 63 | Blocks: hcl.Blocks{}, |
| 64 | }, |
| 65 | 0, |
| 66 | }, |
| 67 | "attribute remains": { |
| 68 | &hcl.BodyContent{ |
| 69 | Attributes: MockAttrs(map[string]hcl.Expression{ |
| 70 | "name": MockExprLiteral(cty.StringVal("Ermintrude")), |
| 71 | }), |
| 72 | }, |
| 73 | &hcl.BodySchema{}, |
| 74 | &hcl.BodyContent{ |
| 75 | Attributes: hcl.Attributes{}, |
| 76 | Blocks: hcl.Blocks{}, |
| 77 | }, |
| 78 | &hcl.BodyContent{ |
nothing calls this directly
no test coverage detected