From 78bbc27fea4344fef376aeb97fcf0a01317252bb Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 9 Oct 2026 11:03:20 +0200 Subject: [PATCH] Test that a read through a name reaching a repeat names the level from the name --- path_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/path_test.go b/path_test.go index 6f70458..a7bf163 100644 --- a/path_test.go +++ b/path_test.go @@ -83,6 +83,11 @@ func TestPathRefusesALevelCarryingARepeat(t *testing.T) { t.Errorf("Fake(%q) = %v, but List() advertises it", p, err) } } + for tmpl, level := range map[string]string{"{/outer.inner as p}{p.a}": "p", "{/outer as o}{o.inner.a}": "o.inner"} { + if _, err := f.NewTemplate(tmpl); err == nil || !strings.Contains(err.Error(), fmt.Sprintf("the level %q carries a repeat", level)) { + t.Errorf("NewTemplate(%s) = %v, want the level %s named", tmpl, err, level) + } + } } // TestPathThroughChoice pins the rule that keeps a dotted path from rendering on