aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cli.t5
-rw-r--r--test/dune1
-rw-r--r--test/test_rite_ef.ml31
3 files changed, 36 insertions, 1 deletions
diff --git a/test/cli.t b/test/cli.t
index 39354c6..0c79db4 100644
--- a/test/cli.t
+++ b/test/cli.t
@@ -336,3 +336,8 @@ An unknown option is rejected rather than treated as a positional word:
colitur: unknown option --diocese
colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> (try: colitur --help)
[2]
+
+The shipped example overlay is runnable documentation, and it must actually
+load -- an example that silently rotted would be worse than none. The cram
+sandbox cannot reach data/, so the assertion that it loads and applies lives
+in test_lectionary_ef.ml, which reads it from the source tree directly.
diff --git a/test/dune b/test/dune
index fb5127f..1e58c26 100644
--- a/test/dune
+++ b/test/dune
@@ -8,6 +8,7 @@
../data/ef/expected-divergences-missalemeum.sexp
../data/ef/lectionary.sexp
../data/ef/commons.sexp
+ ../data/ef/examples/diocesan-example.sexp
fixtures/lectio-ef-2005-2050.txt
fixtures/missalemeum-ef-2026-2027.txt
fixtures/missalemeum-ef-2038.txt
diff --git a/test/test_rite_ef.ml b/test/test_rite_ef.ml
index 4da6d73..f4991f3 100644
--- a/test/test_rite_ef.ml
+++ b/test/test_rite_ef.ml
@@ -526,9 +526,38 @@ let test_maurice_thomas_band_fidelity_end_to_end () =
[ "maurice-and-companions-martyrs" ]
(List.map (fun (c, _) -> slug_of c) day.LD.omitted)
+
+(* The SHIPPED example overlay (data/ef/examples/diocesan-example.sexp) is
+ documentation a user is invited to run and copy, and the man page names its
+ installed path. An example that silently stopped loading -- a directive
+ renamed, a Date_spec variant changed -- would be worse than shipping none,
+ because it would fail only for whoever tried it.
+
+ This asserts it PARSES against the REAL EF rank vocabulary and that it
+ still demonstrates the range it claims to. It deliberately does NOT assert
+ which days it produces: those celebrations are invented, and pinning their
+ dates would make an illustrative file behave like calendar data. *)
+let test_shipped_example_overlay_loads () =
+ let path = "../data/ef/examples/diocesan-example.sexp" in
+ match Overlay.load Rite_ef.Vocab_ef.rank_of_sexp path with
+ | Error e -> Alcotest.failf "the shipped example overlay must load: %s" e
+ | Ok o ->
+ Alcotest.(check string) "its id" "diocesan-example" o.Overlay.id;
+ Alcotest.(check bool) "it demonstrates at least four directives" true
+ (List.length o.Overlay.directives >= 4);
+ (* Applying it must be clean: a directive naming a slug the universal
+ calendar lacks would warn, and an EXAMPLE that warns teaches the
+ wrong lesson. *)
+ let layer = real_layer () in
+ let _, diagnostics = Overlay.apply layer o in
+ Alcotest.(check (list string)) "it applies with no diagnostics" []
+ (List.map Overlay.diagnostic_to_string diagnostics)
+
let suite =
( "Rite_ef (real data: overlay-in-effect, domain-ceiling)",
- [ Alcotest.test_case "the overlay suppression is observably in effect" `Quick
+ [ Alcotest.test_case "the shipped example overlay loads and applies cleanly" `Quick
+ test_shipped_example_overlay_loads;
+ Alcotest.test_case "the overlay suppression is observably in effect" `Quick
test_vigil_of_christmas_suppressed;
Alcotest.test_case "RG16(a) task: the two subject retags are in effect, the other four untouched"
`Quick test_rg16a_subject_retag_in_effect;