tplimpl: Fix issue with recursive templates

Fixes #2927
This commit is contained in:
Bjørn Erik Pedersen
2017-02-18 09:08:00 +01:00
parent 4493e8ed9f
commit bdc02edfa8
2 changed files with 34 additions and 5 deletions

View File

@@ -267,3 +267,24 @@ P2: {{ .Params.LOWER }}
require.Contains(t, result, "P1: P1L")
require.Contains(t, result, "P2: P1L")
}
// Issue #2927
func TestTransformRecursiveTemplate(t *testing.T) {
recursive := `
{{ define "menu-nodes" }}
{{ template "menu-node" }}
{{ end }}
{{ define "menu-node" }}
{{ template "menu-node" }}
{{ end }}
{{ template "menu-nodes" }}
`
templ, err := template.New("foo").Parse(recursive)
require.NoError(t, err)
c := newTemplateContext(templ)
c.paramsKeysToLower(templ.Tree.Root)
}