diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 16:01:39 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-20 16:01:39 +0200 |
| commit | 9dfa264f2941f1ca38eff08b6157a94d332cffbd (patch) | |
| tree | 3c88ace24b4f45f0098f9ef7cf8911582d271bd6 /test/test_citation.ml | |
| parent | c02e77b73aad34fb5a672a5234a66d64f23b45ce (diff) | |
| download | colitur-9dfa264f2941f1ca38eff08b6157a94d332cffbd.tar.gz colitur-9dfa264f2941f1ca38eff08b6157a94d332cffbd.zip | |
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.
Diffstat (limited to 'test/test_citation.ml')
| -rw-r--r-- | test/test_citation.ml | 21 |
1 files changed, 20 insertions, 1 deletions
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 |
