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
+4 -11
View File
@@ -49,13 +49,6 @@ func TestWalkHandsEachCategoryInOrder(t *testing.T) {
}
}
func TestWalkStartsAtTheBaseDir(t *testing.T) {
got, err := walk(t, Source{fsys: fstest.MapFS{"data/a.json": {Data: []byte(`"x"`)}, "b.json": {Data: []byte(`"y"`)}}, base: "data"})
if err != nil || len(got) != 1 || got[0].name != "a" || got[0].dir != nil {
t.Errorf("Walk = %#v, %v, want a alone at the base", got, err)
}
}
func TestReadRowsReadsOnlyAFileBesideTheCategory(t *testing.T) {
src := Source{fsys: fstest.MapFS{
"t.json": {Data: []byte(`{"rows":"t.tsv"}`)},
@@ -138,10 +131,10 @@ func TestWalkRefusesADiskPathThatIsNoDirectory(t *testing.T) {
func TestLoadHandsOneCategoryAndItsRows(t *testing.T) {
src := Source{fsys: fstest.MapFS{
"data/sub/t.json": {Data: []byte(`{"rows":"t.tsv"}`)},
"data/sub/t.tsv": {Data: []byte("key\nA\n")},
"data/sub/u.json": {Data: []byte(`{`)},
}, base: "data"}
"sub/t.json": {Data: []byte(`{"rows":"t.tsv"}`)},
"sub/t.tsv": {Data: []byte("key\nA\n")},
"sub/u.json": {Data: []byte(`{`)},
}}
var got handed
var rows string
err := src.Load([]string{"sub"}, "t", func(c Category) error {