From 17f59c4ddce4ecc8331667997652e4f0bd55dcd4 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 12 Mar 2020 10:00:56 -0700 Subject: [PATCH] fix regex and actually test the check function --- packer/core.go | 2 +- packer/core_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packer/core.go b/packer/core.go index f52becab3..b8682d159 100644 --- a/packer/core.go +++ b/packer/core.go @@ -350,7 +350,7 @@ func (c *Core) validate() error { func isDoneInterpolating(v string) (bool, error) { // Check for whether the var contains any more references to `user`, wrapped // in interpolation syntax. - filter := `{{\s*|user\s*|\x60?.*\x60?}}` + filter := `{{\s*user\s*\x60.*\x60\s*}}` matched, err := regexp.MatchString(filter, v) if err != nil { return false, fmt.Errorf("Can't tell if interpolation is done: %s", err) diff --git a/packer/core_test.go b/packer/core_test.go index e2bfb86d7..8982afbb2 100644 --- a/packer/core_test.go +++ b/packer/core_test.go @@ -679,7 +679,7 @@ func TestSensitiveVars(t *testing.T) { } // Normally I wouldn't test a little helper function, but it's regex. -func testisDoneInterpolating(t *testing.T) { +func TestIsDoneInterpolating(t *testing.T) { cases := []struct { inputString string expectedBool bool