Test cases for compact()

This commit is contained in:
Anthony Stanton 2015-09-15 15:50:31 +02:00
parent 7610874264
commit 735803ef09
1 changed files with 28 additions and 0 deletions

View File

@ -11,6 +11,34 @@ import (
"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) {
testFunction(t, testFunctionConfig{
Cases: []testFunctionCase{