Merge pull request #3986 from hashicorp/phinze/hcl-escaped-quotes

config: test covering escaped quotes syntax error
This commit is contained in:
Paul Hinze 2015-11-19 12:32:30 -06:00
commit afb5136ac2
2 changed files with 34 additions and 0 deletions

View File

@ -70,6 +70,26 @@ func TestLoadFileHeredoc(t *testing.T) {
} }
} }
func TestLoadFileEscapedQuotes(t *testing.T) {
c, err := LoadFile(filepath.Join(fixtureDir, "escapedquotes.tf"))
if err != nil {
t.Fatalf("err: %s", err)
}
if c == nil {
t.Fatal("config should not be nil")
}
if c.Dir != "" {
t.Fatalf("bad: %#v", c.Dir)
}
actual := resourcesStr(c.Resources)
if actual != strings.TrimSpace(escapedquotesResourcesStr) {
t.Fatalf("bad:\n%s", actual)
}
}
func TestLoadFileBasic(t *testing.T) { func TestLoadFileBasic(t *testing.T) {
c, err := LoadFile(filepath.Join(fixtureDir, "basic.tf")) c, err := LoadFile(filepath.Join(fixtureDir, "basic.tf"))
if err != nil { if err != nil {
@ -667,6 +687,13 @@ aws_iam_policy[policy] (x1)
policy policy
` `
const escapedquotesResourcesStr = `
aws_instance[quotes] (x1)
ami
vars
user: var.ami
`
const basicOutputsStr = ` const basicOutputsStr = `
web_ip web_ip
vars vars

View File

@ -0,0 +1,7 @@
variable "ami" {
default = [ "ami", "abc123" ]
}
resource "aws_instance" "quotes" {
ami = "${join(\",\", var.ami)}"
}