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
2 changed files with 13 additions and 12 deletions
Showing only changes of commit a222fb985e - Show all commits
+5 -3
View File
@@ -64,10 +64,11 @@ func TestReplayPairsFindsWhatAWholeReplayFinds(t *testing.T) {
return nil
})
compared := 0
fold := newReadFold()
for _, root := range roots {
compared += wantPairsFindAll(t, root.label, surveyRender(root.t).reads)
compared += wantPairsFindAll(t, root.label, surveyRender(fold, root.t).reads)
if root.t.isRecord && len(root.t.fields) > 0 {
compared += wantPairsFindAll(t, root.label+" as a record", surveyColumns(root.t, sortedNames(root.t.fields)).reads)
compared += wantPairsFindAll(t, root.label+" as a record", surveyColumns(fold, root.t, sortedNames(root.t.fields)).reads)
}
}
if compared == 0 {
@@ -81,6 +82,7 @@ func TestReplayPairsFindsWhatAWholeReplayOfSelectedRowsFinds(t *testing.T) {
t.Fatalf("New = %v", err)
}
var reads []pathRead
fold := newReadFold()
_ = walkNodes(f.root.children, func(_ string, n node) error {
tb, isTable := n.(*table)
if !isTable || tb.keyIndex < 0 || tb.familyRoot().path != "region" {
@@ -95,7 +97,7 @@ func TestReplayPairsFindsWhatAWholeReplayOfSelectedRowsFinds(t *testing.T) {
if !isTemplate {
t.Fatalf("NewTemplate(%s) compiled to %T", tb.selectorSpelling(r), inline.n)
}
reads = append(reads, surveyRender(root).reads...)
reads = append(reads, surveyRender(fold, root).reads...)
}
return nil
})
+8 -9
View File
@@ -10,8 +10,9 @@ func TestEveryReadARenderMakesIsGathered(t *testing.T) {
f := fenceCorpus(t)
roots := fenceRoots(t, f)
traced := 0
fold := newReadFold()
for _, root := range roots {
traced += wantGathered(t, root.label, surveyRender(root.t).reads, func(trace renderTrace) { renderRoot(f.rand, root.t, trace) })
traced += wantGathered(t, root.label, surveyRender(fold, root.t).reads, func(trace renderTrace) { renderRoot(f.rand, root.t, trace) })
if !root.t.isRecord || len(root.t.fields) == 0 {
continue
}
@@ -19,7 +20,7 @@ func TestEveryReadARenderMakesIsGathered(t *testing.T) {
if err != nil {
t.Fatalf("%s: recordOf = %v", root.label, err)
}
traced += wantGathered(t, root.label+" as a record", surveyColumns(root.t, sortedNames(root.t.fields)).reads, func(trace renderTrace) { renderRecordRoot(f.rand, root.t, columns, trace) })
traced += wantGathered(t, root.label+" as a record", surveyColumns(fold, root.t, sortedNames(root.t.fields)).reads, func(trace renderTrace) { renderRecordRoot(f.rand, root.t, columns, trace) })
}
if traced == 0 {
t.Error("no render traced a reference read, so the comparison proved nothing")
@@ -125,7 +126,7 @@ func TestReadSurveyWalksACellByEveryRoute(t *testing.T) {
t.Fatalf("r is a %T, want a template", g.children["r"])
}
var pinned, whole bool
for _, read := range surveyRender(r).reads {
for _, read := range surveyRender(newReadFold(), r).reads {
if read.a.path != "/z" {
continue
}
@@ -157,24 +158,22 @@ func TestReadSurveyReportsAPinClashAsAnError(t *testing.T) {
if !isTemplate {
t.Fatalf("r is a %T, want a template", g.children["r"])
}
if err := surveyRender(r).check(); err == nil || !strings.Contains(err.Error(), "two rows of") {
if err := surveyRender(newReadFold(), r).check(); err == nil || !strings.Contains(err.Error(), "two rows of") {
t.Errorf("check = %v, want y[a]'s row of x clashing with x[2] named, whatever order the fences run in", err)
}
n, isTemplate := g.children["n"].(*template)
if !isTemplate {
t.Fatalf("n is a %T, want a template", g.children["n"])
}
if err := surveyRender(n).check(); err == nil || !strings.HasPrefix(err.Error(), "{f} with {/x[2].v}: x[1] and x[2] are two rows of x") {
if err := surveyRender(newReadFold(), n).check(); err == nil || !strings.HasPrefix(err.Error(), "{f} with {/x[2].v}: x[1] and x[2] are two rows of x") {
t.Errorf("check = %v, want the clash below {f} named by the route the root reaches it by", err)
}
}
func surveyRender(t *template) *readSurvey {
f := newReadFold()
func surveyRender(f *readFold, t *template) *readSurvey {
return survey(f.rootReads(t), t.link.drawGroupKey)
}
func surveyColumns(t *template, columns []string) *readSurvey {
f := newReadFold()
func surveyColumns(f *readFold, t *template, columns []string) *readSurvey {
return survey(f.columnReads(t, columns), t.link.drawGroupKey)
}