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

Function MockAttrs

hcltest/mock.go:348–363  ·  view source on GitHub ↗

MockAttrs constructs and returns a hcl.Attributes map with attributes derived from the given expression map. Each entry in the map becomes an attribute whose name is the key and whose expression is the value.

(exprs map[string]hcl.Expression)

Source from the content-addressed store, hash-verified

346// Each entry in the map becomes an attribute whose name is the key and
347// whose expression is the value.
348func MockAttrs(exprs map[string]hcl.Expression) hcl.Attributes {
349 ret := make(hcl.Attributes)
350 for name, expr := range exprs {
351 ret[name] = &hcl.Attribute{
352 Name: name,
353 Expr: expr,
354 Range: hcl.Range{
355 Filename: "MockAttrs",
356 },
357 NameRange: hcl.Range{
358 Filename: "MockAttrs",
359 },
360 }
361 }
362 return ret
363}

Callers 7

TestExpandFunction · 0.92
TestExpandUnknownBodiesFunction · 0.92
TestExpandMarkedForEachFunction · 0.92
TestDeepFunction · 0.92

Calls

no outgoing calls

Tested by 7

TestExpandFunction · 0.74
TestExpandUnknownBodiesFunction · 0.74
TestExpandMarkedForEachFunction · 0.74
TestDeepFunction · 0.74