mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 00:41:27 -06:00
cb2e9119aa
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
36 lines
923 B
Go
36 lines
923 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package lang
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/opentofu/opentofu/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()
|
|
|
|
// plantimestamp isn't available with ConsoleMode: true
|
|
expectedFunctionCount := len(funcs.DescriptionList) - 1
|
|
|
|
if len(allFunctions) != expectedFunctionCount {
|
|
t.Errorf("DescriptionList length expected: %d, got %d", len(allFunctions), expectedFunctionCount)
|
|
}
|
|
|
|
for name := range allFunctions {
|
|
_, ok := funcs.DescriptionList[name]
|
|
if !ok {
|
|
t.Errorf("missing DescriptionList entry for function %q", name)
|
|
}
|
|
}
|
|
}
|