diff --git a/decoder_test.go b/decoder_test.go index 961c545..79994cb 100644 --- a/decoder_test.go +++ b/decoder_test.go @@ -64,14 +64,7 @@ func TestDecode_interface(t *testing.T) { "bar": "new\nline", "qax": `slash\:colon`, "nested": `${HH\:mm\:ss}`, - "nestedquotes": `${"okay"}`, - }, - }, - { - "interpolate_escape.hcl", - false, - map[string]interface{}{ - "foo": "${file(\"bing/bong.txt\")}", + "nestedquotes": `${"\"stringwrappedinquotes\""}`, }, }, { diff --git a/hcl/strconv/quote.go b/hcl/strconv/quote.go index 6cfd8c3..74e232e 100644 --- a/hcl/strconv/quote.go +++ b/hcl/strconv/quote.go @@ -49,8 +49,7 @@ func Unquote(s string) (t string, err error) { for len(s) > 0 { // If we're starting a '${}' then let it through un-unquoted. // Specifically: we don't unquote any characters within the `${}` - // section, except for escaped quotes and escaped backslashes, which we - // handle specifically. + // section, except for escaped backslashes, which we handle specifically. if s[0] == '$' && len(s) > 1 && s[1] == '{' { buf = append(buf, '$', '{') s = s[2:] @@ -65,12 +64,12 @@ func Unquote(s string) (t string, err error) { s = s[size:] - // We special case escaped double quotes and escaped backslashes in - // interpolations, converting them to their unescaped equivalents. + // We special case escaped backslashes in interpolations, converting + // them to their unescaped equivalents. if r == '\\' { q, _ := utf8.DecodeRuneInString(s) switch q { - case '"', '\\': + case '\\': continue } } diff --git a/hcl/strconv/quote_test.go b/hcl/strconv/quote_test.go index bee3916..c369144 100644 --- a/hcl/strconv/quote_test.go +++ b/hcl/strconv/quote_test.go @@ -36,7 +36,7 @@ var unquotetests = []unQuoteTest{ {`"\a\b\f\n\r\t\v\\\""`, "\a\b\f\n\r\t\v\\\""}, {`"'"`, "'"}, {`"${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)}`}, {`"${HH\\:mm\\:ss}"`, `${HH\:mm\:ss}`}, diff --git a/hcl/token/token_test.go b/hcl/token/token_test.go index b5b766c..932951c 100644 --- a/hcl/token/token_test.go +++ b/hcl/token/token_test.go @@ -50,7 +50,7 @@ func TestTokenValue(t *testing.T) { {Token{Type: IDENT, Text: `foo`}, "foo"}, {Token{Type: STRING, Text: `"foo"`}, "foo"}, {Token{Type: STRING, Text: `"foo\nbar"`}, "foo\nbar"}, - {Token{Type: STRING, Text: `"${file(\"foo\")}"`}, `${file("foo")}`}, + {Token{Type: STRING, Text: `"${file("foo")}"`}, `${file("foo")}`}, {Token{Type: HEREDOC, Text: "<