Tests for runnable layout and row-ambiguity errors, a one-day date span, sexed US titles and the record a fieldless category needs

This commit is contained in:
2026-09-18 19:52:00 +02:00
parent c9c756e2c4
commit bb43345d63
4 changed files with 116 additions and 4 deletions
+15
View File
@@ -547,3 +547,18 @@ func TestRecordTemplateRejectsATopLevelRepeat(t *testing.T) {
t.Errorf("NewTemplate on the same input = %v, want the string view to still compile", err)
}
}
// TestRecordOfAFieldlessCategoryNamesTheWrapper pins the way out of the first
// command a fixture author types: a category of one value has no columns, and the
// error names the record that gives it one.
func TestRecordOfAFieldlessCategoryNamesTheWrapper(t *testing.T) {
f := newGenerator(t, "data", WithSeed(1))
want := `'{"format":"","personnummer":"{/sv_SE.personnummer}"}'`
_, err := f.FakeRecord("sv_SE.personnummer")
if err == nil || !strings.Contains(err.Error(), want) {
t.Fatalf("FakeRecord(sv_SE.personnummer) = %v, want it to name %s", err, want)
}
if _, err := f.FakeRecordTemplate(`{"format":"","personnummer":"{/sv_SE.personnummer}"}`); err != nil {
t.Fatalf("the named wrapper does not render: %v", err)
}
}