diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 17:33:26 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 17:33:26 +0200 |
| commit | 46ffa91fd4fcc2249cd097b3b3a639d37a7d592e (patch) | |
| tree | 8aa5ec165685a21c190bee99a3ed58f648d6fdf8 /test/test_lang_coverage.ml | |
| parent | 152bba4c94060ea2ac7430dfdf826450ee4f2bd8 (diff) | |
| download | colitur-46ffa91fd4fcc2249cd097b3b3a639d37a7d592e.tar.gz colitur-46ffa91fd4fcc2249cd097b3b3a639d37a7d592e.zip | |
fix(lang): stop internal book ids reaching output, and finish the docs
Three defects, all found by running the documented examples rather than
by reading code.
All seven modern-numbering targets carried their own internal id as
their Latin name (kings_1.full = kings_1), so --sigla-tradition modern
printed "kings_1 19:3-8" -- leaking a key book.mli states is never shown
to a reader. They now carry Vulgate-derived Latin names marked
CONSTRUCTED: the 1962 Missal uses Vulgate numbering throughout, so it
can contain no incipit for a book that exists only under a later
convention. In Latin the modern tradition therefore only moves Kings and
Esdras; Osee, Ionas, Ecclesiasticus and the Apocalypse keep their names
either way, since modern numbering is a vernacular convention.
The coverage test could not catch this. It compares a name against its
KEY ("kings_1.full"), and "kings_1" differs from that, so the row
passed. A second check now asserts no name IS its own id. The two are
complementary: one catches a missing row, the other a row present but
filled with the wrong thing. Mutation-proved.
--help still claimed sigla settings were resolved "but not yet
rendered", stale since the render wiring landed. colitur-config.5
documented none of the three settings even though config --show prints
them.
Diffstat (limited to 'test/test_lang_coverage.ml')
| -rw-r--r-- | test/test_lang_coverage.ml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test_lang_coverage.ml b/test/test_lang_coverage.ml index b2d32a4..0271a59 100644 --- a/test/test_lang_coverage.ml +++ b/test/test_lang_coverage.ml @@ -119,6 +119,32 @@ let test_every_book_named () = in Alcotest.(check (list string)) "every book named, both forms" [] missing +(* A name must not BE the internal id. The check above compares the value + against the KEY ("kings_1.full"), so a row reading `kings_1.full = kings_1` + passes it -- the two strings differ. That is exactly what shipped: all seven + tradition targets carried their own id as their name, and + `--sigla-tradition modern` printed "kings_1 19:3-8", leaking a key that + book.mli states is never shown to a reader. + + The two checks are complementary and neither subsumes the other: that one + catches a MISSING row, this one catches a row present but filled with the + wrong thing. *) +let test_no_book_name_is_an_internal_id () = + let la = la () in + let leaked = + List.concat_map + (fun id -> + let n = Colitur_citation.Book.to_string id in + List.filter_map + (fun form -> + let v = L.bible la (n ^ "." ^ form) in + if v = n then Some (n ^ "." ^ form) else None) + [ "full"; "abbr" ]) + Colitur_citation.Book.all + in + Alcotest.(check (list string)) "no book name is its own internal id" [] + leaked + (* lang/en.ini is DELIBERATELY partial (see its own header note): it declares [meta] fallback = la, so a slug it does not carry itself should still resolve through the chain to la.ini's name rather than degrade to the bare @@ -161,4 +187,6 @@ let suite = Alcotest.test_case "vocabularies complete" `Quick test_vocabularies_are_complete; Alcotest.test_case "every rite has a Latin name" `Quick test_every_rite_has_a_latin_name; Alcotest.test_case "every book named, both forms" `Quick test_every_book_named; + Alcotest.test_case "no book name is an internal id" `Quick + test_no_book_name_is_an_internal_id; Alcotest.test_case "en.ini falls back to Latin" `Quick test_en_falls_back_to_latin ] ) |
