(t *testing.T)
| 775 | } |
| 776 | |
| 777 | func TestExpandInvalidIteratorError(t *testing.T) { |
| 778 | srcBody := hcltest.MockBody(&hcl.BodyContent{ |
| 779 | Blocks: hcl.Blocks{ |
| 780 | { |
| 781 | Type: "dynamic", |
| 782 | Labels: []string{"b"}, |
| 783 | LabelRanges: []hcl.Range{hcl.Range{}}, |
| 784 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 785 | Attributes: hcltest.MockAttrs(map[string]hcl.Expression{ |
| 786 | "for_each": hcltest.MockExprLiteral(cty.ListVal([]cty.Value{ |
| 787 | cty.StringVal("dynamic b 0"), |
| 788 | cty.StringVal("dynamic b 1"), |
| 789 | })), |
| 790 | "iterator": hcltest.MockExprLiteral(cty.StringVal("dyn_b")), |
| 791 | }), |
| 792 | Blocks: hcl.Blocks{ |
| 793 | { |
| 794 | Type: "content", |
| 795 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 796 | Blocks: hcl.Blocks{ |
| 797 | { |
| 798 | Type: "c", |
| 799 | Body: hcltest.MockBody(&hcl.BodyContent{ |
| 800 | Attributes: hcltest.MockAttrs(map[string]hcl.Expression{ |
| 801 | "val0": hcltest.MockExprLiteral(cty.StringVal("static c 1")), |
| 802 | "val1": hcltest.MockExprTraversalSrc("dyn_b.value"), |
| 803 | }), |
| 804 | }), |
| 805 | }, |
| 806 | }, |
| 807 | }), |
| 808 | }, |
| 809 | }, |
| 810 | }), |
| 811 | }, |
| 812 | }, |
| 813 | }) |
| 814 | |
| 815 | dynBody := Expand(srcBody, nil) |
| 816 | |
| 817 | t.Run("Decode", func(t *testing.T) { |
| 818 | decSpec := &hcldec.BlockListSpec{ |
| 819 | TypeName: "b", |
| 820 | Nested: &hcldec.BlockListSpec{ |
| 821 | TypeName: "c", |
| 822 | Nested: &hcldec.ObjectSpec{ |
| 823 | "val0": &hcldec.AttrSpec{ |
| 824 | Name: "val0", |
| 825 | Type: cty.String, |
| 826 | }, |
| 827 | "val1": &hcldec.AttrSpec{ |
| 828 | Name: "val1", |
| 829 | Type: cty.String, |
| 830 | }, |
| 831 | }, |
| 832 | }, |
| 833 | } |
| 834 |
nothing calls this directly
no test coverage detected