opentofu/internal/lang/functions_descriptions_test.go
Daniel Banck 4fd8322802
Add function descriptions (#32453)
* Add consolidated function description list

* Add function parameter descriptions

* Add descriptions to all functions

* Add sanity test for function descriptions

* Apply suggestions from code review

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
2023-01-16 10:48:31 +00:00

28 lines
671 B
Go

package lang
import (
"testing"
"github.com/hashicorp/terraform/internal/lang/funcs"
)
func TestFunctionDescriptions(t *testing.T) {
scope := &Scope{
ConsoleMode: true,
}
// This will implicitly test the parameter description count since
// WithNewDescriptions will panic if the number doesn't match.
allFunctions := scope.Functions()
if len(allFunctions) != len(funcs.DescriptionList) {
t.Errorf("DescriptionList length expected: %d, got %d", len(allFunctions), len(funcs.DescriptionList))
}
for name := range allFunctions {
_, ok := funcs.DescriptionList[name]
if !ok {
t.Errorf("missing DescriptionList entry for function %q", name)
}
}
}