Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33
+2
-2
@@ -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)
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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{
|
||||
|
||||
+1
-1
@@ -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)}"`
|
||||
|
||||
+3
-3
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user