fix regex and actually test the check function

This commit is contained in:
Megan Marsh 2020-03-12 10:00:56 -07:00
parent ad5495ac8f
commit 17f59c4ddc
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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