Test that what is well-formed and means one thing loads: ignored parts, constant samples, any JSON value, weight 0, an unread name, a stray rows file, a tagless struct and flags with no effect

This commit is contained in:
2026-10-07 23:33:22 +02:00
committed by Lillem4n
parent 5f8981b14f
commit 052a52fc7a
11 changed files with 94 additions and 82 deletions
+3 -4
View File
@@ -80,10 +80,9 @@ func TestReadRowsReadsOnlyAFileBesideTheCategory(t *testing.T) {
}
}
func TestWalkRefusesARowsFileNoCategoryNames(t *testing.T) {
_, err := walk(t, Source{fsys: fstest.MapFS{"a.json": {Data: []byte(`"x"`)}, "a.tsv": {Data: []byte("key\n")}}, label: "lbl"})
if err == nil || !strings.HasPrefix(err.Error(), "lbl/a.tsv: no category names it in its rows") {
t.Errorf("Walk = %v, want a.tsv refused as named by no category", err)
func TestWalkIgnoresARowsFileNoCategoryNames(t *testing.T) {
if _, err := walk(t, Source{fsys: fstest.MapFS{"a.json": {Data: []byte(`"x"`)}, "a.tsv": {Data: []byte("key\n")}}, label: "lbl"}); err != nil {
t.Errorf("Walk = %v, want a.tsv ignored", err)
}
}