diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-21 22:18:39 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-21 22:18:39 +0200 |
| commit | 2ac3e3e8fcc66e20bf1687ae15f033d20b02216d (patch) | |
| tree | eb767363902495f1b5af523b1a5312f6e9501d06 /test/test_mass_formulary.ml | |
| parent | 4f87cbde4ee79ac96aa7ebfed105b3a5ec02be43 (diff) | |
| download | colitur-2ac3e3e8fcc66e20bf1687ae15f033d20b02216d.tar.gz colitur-2ac3e3e8fcc66e20bf1687ae15f033d20b02216d.zip | |
feat(kernel): a type for which Mass a day says
The lectionary's four-step chain already decides whether a day says its own
proper, its own slug's entry, the preceding Sunday's Mass or a Common, and
then discards that decision once the citations are out. An ordo needs to
print it.
Diffstat (limited to 'test/test_mass_formulary.ml')
| -rw-r--r-- | test/test_mass_formulary.ml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test_mass_formulary.ml b/test/test_mass_formulary.ml new file mode 100644 index 0000000..b940161 --- /dev/null +++ b/test/test_mass_formulary.ml @@ -0,0 +1,29 @@ +module MF = Colitur_kernel.Mass_formulary +module Slug = Colitur_kernel.Slug + +let slug s = Slug.of_string_exn s + +let test_round_trips_through_sexp () = + let f = { MF.said = slug "ef-time-after-pentecost-sunday-9"; via = MF.Preceding_sunday } in + let f' = MF.t_of_sexp (MF.sexp_of_t f) in + Alcotest.(check string) "slug survives" (Slug.to_string f.MF.said) (Slug.to_string f'.MF.said); + Alcotest.(check bool) "source survives" true (f.MF.via = f'.MF.via) + +(* [to_string] is what an ordo line shows. It names the SOURCE, not the slug, + because the slug is a key and the reader wants "of the preceding Sunday". *) +let test_to_string_names_the_source () = + let cases = + [ (MF.Proper, "proper"); (MF.Own_slug, "own"); (MF.Preceding_sunday, "preceding-sunday"); + (MF.Common, "common") ] + in + List.iter + (fun (via, expected) -> + Alcotest.(check string) expected expected + (MF.source_to_string via)) + cases + +let suite = + ( "Mass_formulary", + [ Alcotest.test_case "sexp round-trips" `Quick test_round_trips_through_sexp; + Alcotest.test_case "source_to_string names each source" `Quick + test_to_string_names_the_source ] ) |
