mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-12 09:01:58 -06:00
4fd8322802
* 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>
28 lines
671 B
Go
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)
|
|
}
|
|
}
|
|
}
|