diff --git a/hclsyntax/expression_template_test.go b/hclsyntax/expression_template_test.go index aed9e41..81dda0b 100644 --- a/hclsyntax/expression_template_test.go +++ b/hclsyntax/expression_template_test.go @@ -84,6 +84,12 @@ hello world cty.StringVal("hello $$nonescape"), 0, }, + { + `hello %${"world"}`, + nil, + cty.StringVal("hello %world"), + 0, + }, { `${true}`, nil, @@ -253,6 +259,30 @@ trim`, cty.StringVal("%%"), 0, }, + { + `hello %%{ if true }world%%{ endif }`, + nil, + cty.StringVal(`hello %{ if true }world%{ endif }`), + 0, + }, + { + `hello $%{ if true }world%{ endif }`, + nil, + cty.StringVal("hello $world"), + 0, + }, + { + `%{ endif }`, + nil, + cty.UnknownVal(cty.String), + 1, // Unexpected endif directive + }, + { + `%{ endfor }`, + nil, + cty.UnknownVal(cty.String), + 1, // Unexpected endfor directive + }, } for _, test := range tests {