From 7cb07bfc5dfe4d34e75f314d86e9493bcbf6cfaa Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 29 Sep 2026 14:53:14 +0200 Subject: [PATCH] Pin the reference-draw overlap to wording true of a path and of a family table --- inline_test.go | 4 ++-- record_test.go | 4 ++-- reference_test.go | 4 ++-- struct_test.go | 2 +- table_test.go | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/inline_test.go b/inline_test.go index ffb4572..879b5ea 100644 --- a/inline_test.go +++ b/inline_test.go @@ -108,8 +108,8 @@ func TestFakeTemplateErrors(t *testing.T) { {`name: {/no.such.path}`, "no entry"}, {`name: {..nope}`, "write {/nope}"}, {`{"format":"x"}`, "is a string"}, - {`{/misc.territory} {/misc.territory.alpha2}`, "reads whole the reference draw that {/misc.territory.alpha2} reads a path into; name the fields you want instead, or draw them apart with a drawGroup"}, - {`{"format":"{/misc.territory.alpha2} {x}","x":"{/misc.territory}"}`, "reads whole the reference draw"}, + {`{/misc.territory} {/misc.territory.alpha2}`, "and {/misc.territory.alpha2} share one reference draw, one read whole and one by a path; name the fields you want instead, or draw them apart with a drawGroup"}, + {`{"format":"{/misc.territory.alpha2} {x}","x":"{/misc.territory}"}`, "share one reference draw"}, {`{"format":"{/misc.territory.alpha2}","drawGroup":"g"}`, "nothing can reference"}, } { _, err := f.FakeTemplate(c.input) diff --git a/record_test.go b/record_test.go index e91ff2c..17d2ebb 100644 --- a/record_test.go +++ b/record_test.go @@ -220,7 +220,7 @@ func TestRecordRejectsOverlappingReferenceColumns(t *testing.T) { {"a column reaching back through another category", `{"format":"","whole":"{/mid}","inner":"{/cat.a.b}"}`}, } { _, err := New(WithoutShippedData(), WithDataPath(writeData(t, map[string]string{"cat": cat, "mid": mid, "row": c.row}))) - if err == nil || !strings.Contains(err.Error(), "reads whole the reference draw") { + if err == nil || !strings.Contains(err.Error(), "share one reference draw") { t.Errorf("%s: New = %v, want the overlap refused at load, the way one format is", c.name, err) continue } @@ -236,7 +236,7 @@ func TestInlineRecordRejectsOverlappingColumns(t *testing.T) { }) f := newGenerator(t, dir, WithSeed(1)) _, err := f.FakeRecordTemplate(`{"format":"","whole":"{/cat.a}","inner":"{/cat.a.b}"}`) - if err == nil || !strings.Contains(err.Error(), "reads whole the reference draw") { + if err == nil || !strings.Contains(err.Error(), "share one reference draw") { t.Fatalf("inline record over an overlapping pair = %v, want the inline entry point to refuse it too", err) } } diff --git a/reference_test.go b/reference_test.go index b0d032c..15af699 100644 --- a/reference_test.go +++ b/reference_test.go @@ -271,7 +271,7 @@ func TestReferenceOverlapIsRejected(t *testing.T) { "a bare reference beside a path into what it never renders": `{"format":"{a} {b}","a":"{/cat}","b":"{/cat.p.first}"}`, } { _, err := New(WithoutShippedData(), WithDataPath(writeData(t, map[string]string{"cat": cat, "row": row}))) - if err == nil || !strings.Contains(err.Error(), "reads whole the reference draw") { + if err == nil || !strings.Contains(err.Error(), "share one reference draw") { t.Errorf("%s: New = %v, want the overlap rejected", name, err) } } @@ -413,7 +413,7 @@ func TestSpellingsOfOneReferenceAreOneLevel(t *testing.T) { "sv_SE/person": person, "sv_SE/mail": `"{.person} <{/sv_SE.person.first}>"`, }))) - if err == nil || !strings.Contains(err.Error(), "reads whole the reference draw") || !strings.Contains(err.Error(), "{.person}") { + if err == nil || !strings.Contains(err.Error(), "share one reference draw") || !strings.Contains(err.Error(), "{.person}") { t.Errorf("New = %v, want the bare spelling rejected beside the path spelling", err) } dir := writeData(t, map[string]string{ diff --git a/struct_test.go b/struct_test.go index aa626cb..8300c71 100644 --- a/struct_test.go +++ b/struct_test.go @@ -296,7 +296,7 @@ func TestFakeStructErrors(t *testing.T) { {&struct { A string `fake:"trip.leg"` B string `fake:"trip.leg.to"` - }{}, "reads whole the reference draw"}, + }{}, "share one reference draw"}, {&struct { Trip struct { A int `fake:"{digits(3)}"` diff --git a/table_test.go b/table_test.go index d642d8f..541c6f0 100644 --- a/table_test.go +++ b/table_test.go @@ -367,8 +367,8 @@ func TestTableSelectorInAReference(t *testing.T) { func TestTableSelectionFences(t *testing.T) { rejected := map[string]struct{ json, want string }{ - "bare beside a path": {`"{/region} {/region.name}"`, "reads whole the reference draw"}, - "bare beside a linked path": {`"{/region} {/locality.name}"`, "drawGroup"}, + "bare beside a path": {`"{/region} {/region.name}"`, "share one reference draw"}, + "bare beside a linked path": {`"{/region} {/locality.name}"`, "share one reference draw"}, "selected beside unselected": {`"{/region[12].municipality.name} {/municipality.code}"`, "{/region[12].municipality.code}"}, "relative selected beside unselected": {`"{.region[12].municipality.name} {.municipality.code}"`, "{.region[12].municipality.code}"}, "two selections": {`"{/region[12].name} {/region[14].name}"`, "drawGroup"}, @@ -1120,7 +1120,7 @@ func TestCellReadsMeetWhereTheRenderPairsTheRows(t *testing.T) { "region.json": `{"format":"{name}={note}","rows":"region.tsv","key":"code","name":"name","weight":"population"}`, "x.json": `"{/region}|{/municipality}"`, }) - if _, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, whole)), WithSeed(1)); err == nil || !strings.Contains(err.Error(), "reads whole the reference draw") { + if _, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, whole)), WithSeed(1)); err == nil || !strings.Contains(err.Error(), "share one reference draw") { t.Fatalf("New = %v, want the two drawn rows held to one draw of addr", err) } nested := with(whole, map[string]string{