summaryrefslogtreecommitdiff
path: root/test/test_lang_coverage.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_lang_coverage.ml')
-rw-r--r--test/test_lang_coverage.ml41
1 files changed, 30 insertions, 11 deletions
diff --git a/test/test_lang_coverage.ml b/test/test_lang_coverage.ml
index 96a3383..34758b2 100644
--- a/test/test_lang_coverage.ml
+++ b/test/test_lang_coverage.ml
@@ -20,7 +20,27 @@ let la () =
Task 3 restricted this to "^ef-" slugs only (la.ini's [celebration] table
carried the temporal half alone at the time); Task 4 added the sanctoral
half and REMOVED that filter -- every slug is now in scope, with no
- exceptions. *)
+ exceptions.
+
+ Task 5 CLOSED A SECOND BLIND SPOT: this test used to walk only the
+ OBSERVED day (one Celebration.t per date). A Liturgical_day.t also
+ carries a whole second stream of slugs -- commemorations (kept when the
+ observed day does not fully displace a losing candidate, RG 108-111) and
+ transfers (an impeded I/II-class feast moved to a later date, RG 96-98).
+ The ordo booklet printed raw slugs ("Commemoratio canute-martyr",
+ "Commemoratio maur-abbot", "Commemoratio peter") precisely because
+ nothing here ever looked at [commemorations], [transferred_in] or
+ [transferred_out] -- the test asserted coverage of what it happened to
+ WALK, not of what the engine can EMIT. Now walks all four fields, so any
+ slug reachable through any of them is in scope. *)
+let slugs_of_day (d : (Rite_ef.Vocab_ef.season, Rite_ef.Vocab_ef.rank) Colitur_kernel.Liturgical_day.t) =
+ let open Colitur_kernel in
+ let slug (c : _ Celebration.t) = Slug.to_string c.Celebration.slug in
+ (slug d.Liturgical_day.observed)
+ :: List.map (fun (c, _priv) -> slug c) d.Liturgical_day.commemorations
+ @ (match d.Liturgical_day.transferred_in with None -> [] | Some c -> [ slug c ])
+ @ List.map (fun (c, _date) -> slug c) d.Liturgical_day.transferred_out
+
let test_every_slug_has_a_latin_name () =
let t = la () in
let layer = match Test_support.load_ef_layer () with Ok l -> l | Error e -> Alcotest.failf "%s" e in
@@ -28,19 +48,18 @@ let test_every_slug_has_a_latin_name () =
let missing = ref [] in
for y = 2020 to 2045 do
Array.iter
- (fun (d : (Rite_ef.Vocab_ef.season, Rite_ef.Vocab_ef.rank) Colitur_kernel.Liturgical_day.t) ->
- let slug =
- Colitur_kernel.Slug.to_string
- d.Colitur_kernel.Liturgical_day.observed.Colitur_kernel.Celebration.slug
- in
- (* A miss returns the key itself, so name = slug means "no entry". *)
- if L.celebration t slug = slug && not (List.mem slug !missing) then
- missing := slug :: !missing)
+ (fun d ->
+ List.iter
+ (fun slug ->
+ (* A miss returns the key itself, so name = slug means "no entry". *)
+ if L.celebration t slug = slug && not (List.mem slug !missing) then
+ missing := slug :: !missing)
+ (slugs_of_day d))
(Colitur_kernel.Calendar.year ctx layer y)
done;
if !missing <> [] then
- Alcotest.failf "%d slugs have no Latin name, e.g. %s" (List.length !missing)
- (String.concat ", " (List.filteri (fun i _ -> i < 5) !missing))
+ Alcotest.failf "%d slugs have no Latin name: %s" (List.length !missing)
+ (String.concat ", " (List.sort compare !missing))
let test_vocabularies_are_complete () =
let t = la () in