Link every test fragment before asserting on it

This commit is contained in:
2026-09-28 02:53:08 +02:00
committed by Lillem4n
parent e0969e69e7
commit e11ee9ec0e
9 changed files with 36 additions and 26 deletions
+12 -2
View File
@@ -113,10 +113,20 @@ func parse(t *testing.T, s string) any {
return v
}
// compiled parses and compiles a JSON fragment into a node.
func compiled(t *testing.T, s string) node {
// linked compiles a JSON fragment and links it against no data.
func linked(t *testing.T, s string) (node, error) {
t.Helper()
n, err := compile(parse(t, s))
if err != nil {
return nil, err
}
return n, linkNodeRefs(inlineScope(n, "template"), nil)
}
// compiled parses, compiles and links a JSON fragment into a node.
func compiled(t *testing.T, s string) node {
t.Helper()
n, err := linked(t, s)
if err != nil {
t.Fatalf("compile %q: %v", s, err)
}