Merge pull request #63 from hashicorp/phinze/handle-multiple-interpolations-in-string
Handle multiple interpolations in string.
This commit is contained in:
commit
5f90c29834
@ -86,7 +86,12 @@ func Unquote(s string) (t string, err error) {
|
|||||||
return "", ErrSyntax
|
return "", ErrSyntax
|
||||||
}
|
}
|
||||||
if len(s) == 0 {
|
if len(s) == 0 {
|
||||||
|
// If there's no string left, we're done!
|
||||||
break
|
break
|
||||||
|
} else {
|
||||||
|
// If there's more left, we need to pop back up to the top of the loop
|
||||||
|
// in case there's another interpolation in this string.
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ var unquotetests = []unQuoteTest{
|
|||||||
{`"'"`, "'"},
|
{`"'"`, "'"},
|
||||||
{`"${file("foo")}"`, `${file("foo")}`},
|
{`"${file("foo")}"`, `${file("foo")}`},
|
||||||
{`"${file(\"foo\")}"`, `${file("foo")}`},
|
{`"${file(\"foo\")}"`, `${file("foo")}`},
|
||||||
|
{`"echo ${var.region}${element(split(",",var.zones),0)}"`,
|
||||||
|
`echo ${var.region}${element(split(",",var.zones),0)}`},
|
||||||
}
|
}
|
||||||
|
|
||||||
var misquoted = []string{
|
var misquoted = []string{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user