Tests: name the draw option drawGroup, and refuse a draw group whose reads all sit behind a nested one

This commit is contained in:
2026-09-16 08:55:39 +02:00
parent d3f430bf53
commit 53a87da9b7
5 changed files with 31 additions and 30 deletions
+2 -2
View File
@@ -203,7 +203,7 @@ func TestRecordRejectsOverlappingReferenceColumns(t *testing.T) {
cat := `{"format":"{a}","a":[{"format":"A={b}","b":"1"},{"format":"A={b}","b":"2"}]}`
for _, c := range []struct{ name, row string }{
{"through a column repeat, which draws anew", `{"format":"","whole":"{/cat.a}","inner":{"format":"{/cat.a.b}","repeat":2,"separator":"-"}}`},
{"in a group of its own", `{"format":"","whole":{"format":"{/cat.a}","group":"g"},"inner":"{/cat.a.b}"}`},
{"in a group of its own", `{"format":"","whole":{"format":"{/cat.a}","drawGroup":"g"},"inner":"{/cat.a.b}"}`},
} {
f := newGenerator(t, writeData(t, map[string]string{"cat": cat, "row": c.row}), WithSeed(1))
if _, err := f.FakeRecord("row"); err != nil {
@@ -384,7 +384,7 @@ func TestRepeatIterationsDrawReferencesAnew(t *testing.T) {
func TestRecordGroupsDrawApart(t *testing.T) {
dir := writeData(t, map[string]string{
"person": drawPeople,
"transfer": `{"format":"{from_first} {from_last} to {to_first} {to_last}","from_first":{"format":"{/person.first}","group":"from"},"from_last":{"format":"{/person.last}","group":"from"},"to_first":{"format":"{/person.first}","group":"to"},"to_last":{"format":"{/person.last}","group":"to"}}`,
"transfer": `{"format":"{from_first} {from_last} to {to_first} {to_last}","from_first":{"format":"{/person.first}","drawGroup":"from"},"from_last":{"format":"{/person.last}","drawGroup":"from"},"to_first":{"format":"{/person.first}","drawGroup":"to"},"to_last":{"format":"{/person.last}","drawGroup":"to"}}`,
})
f := newGenerator(t, dir, WithSeed(1))
apart := map[string]bool{}