aboutsummaryrefslogtreecommitdiff
path: root/test/test_emit.ml
Commit message (Collapse)AuthorAgeFilesLines
* test(emit): replace two vacuous CSV/XML assertions with real onesLukasz Kasprzak2026-08-191-11/+103
| | | | | | | | | | | | | | | | | | | | | The live-data CSV assertion inspected only the first field's length, always the 10-char ISO date, which can never contain a comma -- it could not fail no matter what emit_csv.ml did with the rest of the row. Mutation-proved: replacing emit_csv.ml's escape_field call with identity left every test green while the real output emitted a 14-field row against a 13-column header. Fixed by parsing the row as RFC 4180 actually requires (a small quote-aware splitter) and asserting the field count matches the header, plus asserting the quoted substring appears literally. The XML suite asserted Escape.Xml's correctness in isolation but never that emit_xml.ml actually calls it on every interpolated value. Bypassing one escape call at the name-element site left all tests green while real 2035 output (Sts. Fabian & Sebastian, 20 January) emitted a bare '&' that xmllint rejects. Fixed by adding a live-data test against the 2035 fixture asserting an escaped ampersand is present and no bare one remains. Both new assertions were run against their named mutations and confirmed to redden before being reverted.
* feat(render): XML emitter and schemaLukasz Kasprzak2026-08-191-0/+34
| | | | | | | | | | | | | Element-per-field; attributes carry identity only and there is no mixed content, so a consumer's XPath never has to distinguish the two. Schema validation is an opt-in make check-schema via xmllint, not an in-suite assertion: validating XSD needs an XML library and the dependency list is frozen. It prints SKIPPED loudly when xmllint is absent, because a silent skip reads as a pass. The suite asserts well-formedness properties directly instead. This corrects the design spec, which claimed in-test validation.
* feat(render): CSV and JSON emitters, and the published contractLukasz Kasprzak2026-08-191-0/+77
Both consume the VIEW, not the kernel, so every emitter and every template describe exactly the same fields -- there is one vocabulary, not five. CSV is RFC 4180: a field with a comma is quoted. That is live on real data, not hypothetical -- 'St. Joseph, Spouse of the Bl. Virgin Mary' would otherwise split into two columns. JSON is hand-rolled because the dependency list is frozen and escaping is the only subtlety. Control characters below 0x20 are \u-escaped per RFC 8259 section 7. There are no numbers in the view, deliberately: a consumer never has to guess whether week is 2 or "2". schema/day-v1.json pins the shape. Once a phone subscribes or a site fetches this, it is a promise to strangers -- adding a field is minor, renaming one means /v2/.