(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestExpand(t *testing.T) { |
| 20 | srcBody := hcltest.MockBody(&hcl.BodyContent{ |
| 21 | Blocks: hcl.Blocks{ |
| 22 | { |
| 23 | Type: "a", |
| 24 | Labels: []string{"static0"}, |
| 25 | LabelRanges: []hcl.Range{hcl.Range{}}, |
| 26 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 27 | Attributes: hcltest.MockAttrs(map[string]hcl.Expression{ |
| 28 | "val": hcltest.MockExprLiteral(cty.StringVal("static a 0")), |
| 29 | }), |
| 30 | }), |
| 31 | }, |
| 32 | { |
| 33 | Type: "b", |
| 34 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 35 | Blocks: hcl.Blocks{ |
| 36 | { |
| 37 | Type: "c", |
| 38 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 39 | Attributes: hcltest.MockAttrs(map[string]hcl.Expression{ |
| 40 | "val0": hcltest.MockExprLiteral(cty.StringVal("static c 0")), |
| 41 | }), |
| 42 | }), |
| 43 | }, |
| 44 | { |
| 45 | Type: "dynamic", |
| 46 | Labels: []string{"c"}, |
| 47 | LabelRanges: []hcl.Range{hcl.Range{}}, |
| 48 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 49 | Attributes: hcltest.MockAttrs(map[string]hcl.Expression{ |
| 50 | "for_each": hcltest.MockExprLiteral(cty.ListVal([]cty.Value{ |
| 51 | cty.StringVal("dynamic c 0"), |
| 52 | cty.StringVal("dynamic c 1"), |
| 53 | })), |
| 54 | "iterator": hcltest.MockExprVariable("dyn_c"), |
| 55 | }), |
| 56 | Blocks: hcl.Blocks{ |
| 57 | { |
| 58 | Type: "content", |
| 59 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 60 | Attributes: hcltest.MockAttrs(map[string]hcl.Expression{ |
| 61 | "val0": hcltest.MockExprTraversalSrc("dyn_c.value"), |
| 62 | }), |
| 63 | }), |
| 64 | }, |
| 65 | }, |
| 66 | }), |
| 67 | }, |
| 68 | }, |
| 69 | }), |
| 70 | }, |
| 71 | { |
| 72 | Type: "dynamic", |
| 73 | Labels: []string{"a"}, |
| 74 | LabelRanges: []hcl.Range{hcl.Range{}}, |
| 75 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 76 | Attributes: hcltest.MockAttrs(map[string]hcl.Expression{ |
nothing calls this directly
no test coverage detected