opentofu/terraform/node_root_variable_test.go
Kristin Laemmert f64d5b237c
terraform: refactor nodeModuleVariable and NodeRootVariable EvalTree()s (#26245)
EvalModuleCallArguments is now a method on nodeModuleVariable, it's only
caller, and the other functions have been replaces with straight through
code (or in the case of evalVariableValidations, a standalone function).

I was unable to add tests for nodeModuleVariable.Execute, which requires
fixtures that aren't part of the MockEvalContext (a scope.evalContext is
one); it's not ideal but that function should be well covered by the
context tests so I chose to leave it as-is.

Finally, I removed the unused function hclTypeName. Deleting code is
fun!
2020-09-16 11:32:48 -04:00

26 lines
430 B
Go

package terraform
import (
"testing"
"github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs"
)
func TestNodeRootVariableExecute(t *testing.T) {
ctx := new(MockEvalContext)
n := &NodeRootVariable{
Addr: addrs.InputVariable{Name: "foo"},
Config: &configs.Variable{
Name: "foo",
},
}
err := n.Execute(ctx, walkApply)
if err != nil {
t.Fatalf("unexpected error: %s", err.Error())
}
}