MCPcopy
hub / github.com/hashicorp/hcl / TestExpandUnknownBodies

Function TestExpandUnknownBodies

ext/dynblock/expand_body_test.go:425–712  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

423}
424
425func TestExpandUnknownBodies(t *testing.T) {
426 srcContent := &hcl.BodyContent{
427 Blocks: hcl.Blocks{
428 {
429 Type: "dynamic",
430 Labels: []string{"list"},
431 LabelRanges: []hcl.Range{hcl.Range{}},
432 Body: hcltest.MockBody(&hcl.BodyContent{
433 Attributes: hcltest.MockAttrs(map[string]hcl.Expression{
434 "for_each": hcltest.MockExprLiteral(cty.UnknownVal(cty.Map(cty.String))),
435 }),
436 Blocks: hcl.Blocks{
437 {
438 Type: "content",
439 Body: hcltest.MockBody(&hcl.BodyContent{
440 Attributes: hcltest.MockAttrs(map[string]hcl.Expression{
441 "val": hcltest.MockExprTraversalSrc("each.value"),
442 }),
443 }),
444 },
445 },
446 }),
447 },
448 {
449 Type: "dynamic",
450 Labels: []string{"tuple"},
451 LabelRanges: []hcl.Range{hcl.Range{}},
452 Body: hcltest.MockBody(&hcl.BodyContent{
453 Attributes: hcltest.MockAttrs(map[string]hcl.Expression{
454 "for_each": hcltest.MockExprLiteral(cty.UnknownVal(cty.Map(cty.String))),
455 }),
456 Blocks: hcl.Blocks{
457 {
458 Type: "content",
459 Body: hcltest.MockBody(&hcl.BodyContent{
460 Attributes: hcltest.MockAttrs(map[string]hcl.Expression{
461 "val": hcltest.MockExprTraversalSrc("each.value"),
462 }),
463 }),
464 },
465 },
466 }),
467 },
468 {
469 Type: "dynamic",
470 Labels: []string{"set"},
471 LabelRanges: []hcl.Range{hcl.Range{}},
472 Body: hcltest.MockBody(&hcl.BodyContent{
473 Attributes: hcltest.MockAttrs(map[string]hcl.Expression{
474 "for_each": hcltest.MockExprLiteral(cty.UnknownVal(cty.Map(cty.String))),
475 }),
476 Blocks: hcl.Blocks{
477 {
478 Type: "content",
479 Body: hcltest.MockBody(&hcl.BodyContent{
480 Attributes: hcltest.MockAttrs(map[string]hcl.Expression{
481 "val": hcltest.MockExprTraversalSrc("each.value"),
482 }),

Callers

nothing calls this directly

Calls 13

ErrorMethod · 0.95
MockBodyFunction · 0.92
MockAttrsFunction · 0.92
MockExprLiteralFunction · 0.92
MockExprTraversalSrcFunction · 0.92
MockExprListFunction · 0.92
PartialDecodeFunction · 0.92
ExpandFunction · 0.85
RunMethod · 0.80
ListMethod · 0.80
ObjectMethod · 0.80
SetMethod · 0.80

Tested by

no test coverage detected