From 9dfa264f2941f1ca38eff08b6157a94d332cffbd Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 20 Aug 2026 16:01:39 +0200 Subject: feat(lang): traditions.ini, and its install rule Which book a reference denotes does not vary by language, so it lives in its own file rather than in la.ini beside [weekday]. Six mappings, not four: Osee/Jonas are the same question as 3 Kings in transliteration form. The install rule is added in the same commit deliberately -- lang/ once shipped without one, so the feature worked from the source tree and was broken once installed. bin/dune gains colitur_citation as a linked library, needed for the new loader; lang_list's directory scan now excludes traditions.ini, which is not a language file and does not parse as one. --- test/dune | 6 +++++- test/test_citation.ml | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/dune b/test/dune index a90b715..d883d2f 100644 --- a/test/dune +++ b/test/dune @@ -6,6 +6,7 @@ ../data/ef/adjustments.sexp ../lang/la.ini ../lang/en.ini + ../lang/traditions.ini ../data/ef/expected-divergences.sexp ../data/ef/expected-divergences-missalemeum.sexp ../data/ef/lectionary.sexp @@ -55,4 +56,7 @@ ; back to the workspace root's own default alias), so schema/day-v1.json ; needs its own entry here too, exactly like every other runtime file ; above. - ../schema/day-v1.json)) + ../schema/day-v1.json + ; Same trap, same fix: Task 8's --sigla-tradition flag makes the CLI read + ; this file, and a cram sandbox holds only what this stanza names. + ../lang/traditions.ini)) diff --git a/test/test_citation.ml b/test/test_citation.ml index 25fc260..d9be86e 100644 --- a/test/test_citation.ml +++ b/test/test_citation.ml @@ -174,6 +174,23 @@ let test_every_data_file_token_resolves () = Alcotest.failf "unresolved book tokens in shipped data: %s" (String.concat ", " unresolved) +(* lang/traditions.ini's own [modern] section, duplicated here on purpose: + the shipped file and this expectation are written twice and must agree, + so a typo in either is visible. Two ids mapping onto the SAME target is + always a typo -- it would silently merge two books -- so this asserts the + mapping is injective, not merely that every id is known. *) +let test_modern_tradition_is_injective () = + let fields = + [ ("kings_3", "kings_1"); ("kings_4", "kings_2"); + ("esdras_2", "nehemiah"); ("ecclesiasticus", "sirach"); + ("osee", "hosea"); ("jonas", "jonah") ] + in + Alcotest.(check (list string)) "all ids known" [] (B.unknown_fields fields); + let targets = List.map snd fields in + let uniq = List.sort_uniq compare targets in + Alcotest.(check int) "no two ids share a target" + (List.length targets) (List.length uniq) + let suite = ( "book", [ Alcotest.test_case "both spellings one book" `Quick test_both_spellings_are_one_book; @@ -185,7 +202,9 @@ let suite = Alcotest.test_case "tokens has no duplicate spelling" `Quick test_tokens_has_no_duplicate_spelling; Alcotest.test_case "every data file token resolves" `Quick - test_every_data_file_token_resolves ] ) + test_every_data_file_token_resolves; + Alcotest.test_case "modern tradition is injective" `Quick + test_modern_tradition_is_injective ] ) module P = Colitur_citation.Parse -- cgit v1.3