mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Test cases for compact()
This commit is contained in:
parent
7610874264
commit
735803ef09
@ -11,6 +11,34 @@ import (
|
|||||||
"github.com/hashicorp/terraform/config/lang/ast"
|
"github.com/hashicorp/terraform/config/lang/ast"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func TestInterpolateFuncCompact(t *testing.T) {
|
||||||
|
testFunction(t, testFunctionConfig{
|
||||||
|
Cases: []testFunctionCase{
|
||||||
|
// empty string within array
|
||||||
|
{
|
||||||
|
`${compact(split(",", "b,,c"))}`,
|
||||||
|
NewStringList([]string{"b", "c"}).String(),
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
|
||||||
|
// empty string at the end of array
|
||||||
|
{
|
||||||
|
`${compact(split(",", "b,c,"))}`,
|
||||||
|
NewStringList([]string{"b", "c"}).String(),
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
|
||||||
|
// single empty string
|
||||||
|
{
|
||||||
|
`${compact(split(",", ""))}`,
|
||||||
|
NewStringList([]string{}).String(),
|
||||||
|
false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestInterpolateFuncDeprecatedConcat(t *testing.T) {
|
func TestInterpolateFuncDeprecatedConcat(t *testing.T) {
|
||||||
testFunction(t, testFunctionConfig{
|
testFunction(t, testFunctionConfig{
|
||||||
Cases: []testFunctionCase{
|
Cases: []testFunctionCase{
|
||||||
|
Loading…
Reference in New Issue
Block a user