Test that each shipped module renders beside the modules it reads, that the test's module list matches data.Modules(), and that a data path's manifest and an indexed one each name what they read

This commit is contained in:
2026-10-10 13:16:59 +02:00
committed by Lillem4n
parent d79be8b50a
commit e8b7d95559
5 changed files with 66 additions and 57 deletions
+5 -10
View File
@@ -8,7 +8,7 @@ import (
// loadSources merges sources in order, the last winning a clash. A source whose manifest
// carries an index leaves its categories unloaded; every other source loads here, with
// the unloaded categories it needs: docs/decisions.md#a-source-whose-manifest-carries-an-index-loads-each-category-on-first-reach-any-other-loads-in-new-with-what-it-reads
// the unloaded categories it needs.
func loadSources(sources []datafiles.Source) (folder, error) {
root := folder{children: map[string]node{}}
for _, src := range sources {
@@ -25,16 +25,13 @@ func addSource(root *folder, src datafiles.Source) error {
return err
}
if m.Index != nil {
placeIndex(root, src, m)
placeIndex(root, src, m.Index)
return nil
}
g := &folder{children: map[string]node{}}
if err := src.Walk(compileInto(func(dir []string) *folder { return madeFolder(g, dir) })); err != nil {
return err
}
for _, s := range categorySites(g) {
s.in.setReads(s.name, m.Reads)
}
mergeFolder(root, g)
return nil
}
@@ -73,7 +70,6 @@ func mergeFolder(dst, src *folder) {
}
}
dst.put(k, v)
dst.setReads(k, src.reads[k])
}
}
@@ -84,9 +80,8 @@ type nodeSet func(fn func(label string, n node) error) error
// categorySite is a loaded category, where it sits and its own dot path.
type categorySite struct {
categoryAt
n node
path string
reads []string
n node
path string
}
// categorySites lists every category under root, folders and names in sorted order.
@@ -107,7 +102,7 @@ func categorySites(root *folder) []categorySite {
}
func siteIn(dir []string, in *folder, name string) categorySite {
return categorySite{categoryAt: categoryAt{dir: dir, in: in, name: name}, n: in.children[name], path: categoryPath(dir, name), reads: in.reads[name]}
return categorySite{categoryAt: categoryAt{dir: dir, in: in, name: name}, n: in.children[name], path: categoryPath(dir, name)}
}
func categoryPath(dir []string, name string) string { return join(strings.Join(dir, "."), name) }