Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33

Open
lilleman wants to merge 966 commits from worktree-todo-relative-dates-exact-counts into main
Showing only changes of commit a9ec8b3632 - Show all commits
+10 -4
View File
@@ -760,12 +760,18 @@ func TestRepeatedBareTokenOfAHeldNameIsRejected(t *testing.T) {
} }
} }
func TestReadFieldPanicsOnAnUnheldPath(t *testing.T) { func TestReadFieldPanicsOnAPathItCannotHold(t *testing.T) {
tm, ok := compiled(t, `{"format":"{w}","w":{"format":"{x}","x":"1"}}`).(*template) a := arm{spelling: "w.x", key: "w", tail: []string{"x"}, path: "w.x"}
for name, format := range map[string]string{
"unheld arm with a path": `{"format":"{w}","w":{"format":"{x}","x":"1"}}`,
"held arm with no hold": `{"format":"{w.x}","w":{"format":"{x}","x":"1"}}`,
} {
tm, ok := compiled(t, format).(*template)
if !ok { if !ok {
t.Fatal("not a template") t.Fatal("not a template")
} }
mustPanic(t, "unheld arm with a path", func() { mustPanic(t, name, func() {
readField(engine(1).rand, tm, nil, renderScope{set: &holdSet{}}, arm{spelling: "w.x", key: "w", tail: []string{"x"}, path: "w.x"}) readField(engine(1).rand, tm, nil, renderScope{set: &holdSet{}}, a)
}) })
} }
}