Tests for a reference reaching into a calc operand

{net.v} is a load error because the operand is also a path head, but
{..cat.net.v} names the same node by another spelling and loads — and
disagrees in 20 of 40 renders. Same shape, opposite verdicts, which is the
thing this rule exists to remove.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
M
2026-08-31 21:19:17 +02:00
committed by lilleman-tw
parent cf3229cd4d
commit 8d03ce34bb
+17
View File
@@ -183,6 +183,23 @@ func TestACalcOperandIsHeldAgainstEveryRoute(t *testing.T) {
},
`calc operand "b" renders "a"`,
},
// Reaching *into* the operand is the same shape as naming it: the draw the
// calc holds settled that value too. The token spelling {net.v} is already
// rejected, so the reference spelling has to be.
"a reference into the operand": {
map[string]string{
"cat": `{"format":"{calc(net * 2, 2)}|{..cat.net.v}",` +
`"net":{"format":"{v}","v":["10.00","20.00"]}}`,
},
`{..cat.net.v} renders "net"`,
},
"a reference into the operand one level down": {
map[string]string{
"cat": `{"format":"{calc(net * 2, 2)}|{q}","net":{"format":"{v}","v":["10.00","20.00"]},` +
`"q":{"format":"{..cat.net.v}"}}`,
},
`{q} renders "net"`,
},
}
for name, c := range rejected {
_, err := New([]string{writeData(t, c.files)})