From 84b3252bfcc8d86b4d6bfaa2179c668a4e9299fe Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 24 Sep 2026 13:45:53 +0200 Subject: [PATCH] Walk a template's fields in the shape test without skipping reference bindings --- shape_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/shape_test.go b/shape_test.go index 6107d07..e9d418e 100644 --- a/shape_test.go +++ b/shape_test.go @@ -104,10 +104,8 @@ func readsFact(n node) string { for _, b := range n.refs { set[strings.TrimPrefix(b.key, "/")] = true } - for name, field := range n.fields { - if !isRef(name) { - collect(field) - } + for _, field := range n.fields { + collect(field) } } } @@ -130,8 +128,9 @@ func TestShippedShapeNamesReads(t *testing.T) { "c": `{"format":"{v} {n}","n":[null,{"format":"{int(1,9)}","datatype":"integer"}],"v":["z","w"]}`, "d/pos": `["{.q}","{/b}"]`, "d/q": `"r"`, + "e": `"{/a}"`, })) - want := "a\tformat \"{x}\"\treads b c\na.x\tstring\nb\tformat \"y\"\nc\tformat \"{v} {n}\"\nc.n\tinteger null\nc.v\tstring\nd.pos\treads b d.q\nd.q\tformat \"r\"\n" + want := "a\tformat \"{x}\"\treads b c\na.x\tstring\nb\tformat \"y\"\nc\tformat \"{v} {n}\"\nc.n\tinteger null\nc.v\tstring\nd.pos\treads b d.q\nd.q\tformat \"r\"\ne\tformat \"{/a}\"\treads a\n" if got := shippedShape(f); got != want { t.Fatalf("shippedShape =\n%s\nwant\n%s", got, want) }