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 c29885e31f - Show all commits
+22 -8
View File
@@ -1046,10 +1046,10 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) {
} }
} }
// TestProbeReportsTheTablesADrawPins holds the check mode to the render: the tables a probe says a // TestTableReadReportsTheTablesADrawPins holds a path's compiled steps to the render: the tables
// path draws are those a draw of it pins beyond what its selectors pin, and each selector is credited // its table read says it draws are those a draw of it pins beyond what its selectors pin, each
// to the table it selects a row of. // selector is credited to the table it selects a row of, and a step naming a segment sits at it.
func TestProbeReportsTheTablesADrawPins(t *testing.T) { func TestTableReadReportsTheTablesADrawPins(t *testing.T) {
f := newGenerator(t, writeFiles(t, geo()), WithSeed(1)) f := newGenerator(t, writeFiles(t, geo()), WithSeed(1))
for _, c := range []struct{ path, sels string }{ for _, c := range []struct{ path, sels string }{
{"locality.code", ""}, {"locality.code", ""},
@@ -1070,26 +1070,40 @@ func TestProbeReportsTheTablesADrawPins(t *testing.T) {
a := splitArm(c.path, nil) a := splitArm(c.path, nil)
head := f.root.children[a.head].(*table) head := f.root.children[a.head].(*table)
a.steps = compilePath(head, a.tail).steps a.steps = compilePath(head, a.tail).steps
for _, st := range a.steps {
seg := ""
switch st.kind {
case stepSelect:
seg = "[" + st.name + "]"
case stepChild, stepColumn:
seg = st.name
default:
continue
}
if st.at >= len(a.tail) || a.tail[st.at] != seg {
t.Errorf("%s: step %q sits at %d, want the segment it consumes", c.path, seg, st.at)
}
}
tr := tableReadOf(head, a, nil) tr := tableReadOf(head, a, nil)
var sels []string var sels []string
for _, s := range tr.sels { for _, s := range tr.sels {
sels = append(sels, s.t.segment+"="+s.spelling) sels = append(sels, s.t.segment+"="+s.spelling)
} }
if got := strings.Join(sels, " "); got != c.sels { if got := strings.Join(sels, " "); got != c.sels {
t.Errorf("%s: the probe credits the selectors %q, want %q", c.path, got, c.sels) t.Errorf("%s: the table read credits the selectors %q, want %q", c.path, got, c.sels)
} }
probed, drawn := tr.pins, tr.drawn selected, drawn := tr.pins, tr.drawn
for i := 0; i < 20; i++ { for i := 0; i < 20; i++ {
var pins pinSet var pins pinSet
drawPath(head, a.tail, a.head, &pathDraw{s: f.rand, pins: &pins}) drawPath(head, a.tail, a.head, &pathDraw{s: f.rand, pins: &pins})
want := map[*table]bool{} want := map[*table]bool{}
pins.each(func(tbl *table, _ int) { pins.each(func(tbl *table, _ int) {
if _, selected := probed.pinned(tbl); !selected { if _, isSelected := selected.pinned(tbl); !isSelected {
want[tbl] = true want[tbl] = true
} }
}) })
if !maps.Equal(drawn, want) { if !maps.Equal(drawn, want) {
t.Fatalf("%s: the probe reports %v drawn, a draw pins %v", c.path, segmentsOf(drawn), segmentsOf(want)) t.Fatalf("%s: the table read reports %v drawn, a draw pins %v", c.path, segmentsOf(drawn), segmentsOf(want))
} }
} }
} }