summaryrefslogtreecommitdiff
path: root/test/test_view.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 22:40:13 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-20 22:40:13 +0200
commitf73bd5d0e33146c24af1e98bf9ea26bd8cbf004b (patch)
tree790100dcc0077532d9446478e51d4cd40209c1c6 /test/test_view.ml
parent2d8942e08edcbe5430f97270bdb1233e287600ee (diff)
parent671c4264707ec8c81845059746632b00f2481d88 (diff)
downloadcolitur-f73bd5d0e33146c24af1e98bf9ea26bd8cbf004b.tar.gz
colitur-f73bd5d0e33146c24af1e98bf9ea26bd8cbf004b.zip
Merge branch 'robustness-and-hackability'
An audit of the shipped program, plus the fixes it found. The citation parser accepted OCaml integer-literal syntax, so a typo like 'Luke 1_1:5' silently became a different chapter. Four pairs of different books shared a full title -- 1 and 2 Corinthians both rendered 'Epistola ad Corinthios' -- leaving 108 citations in 2027 alone that a reader could not resolve to a book. Spec section 8.5 is now delivered rather than recorded: shipped styles re-parse their own output. Overlay errors no longer name OCaml source files at the reader. Also: the new-overlay scaffold shows citations at the right nesting level, config --show validates before printing, error messages no longer echo whole file lines, and a month answers to both spellings of its own name.
Diffstat (limited to 'test/test_view.ml')
-rw-r--r--test/test_view.ml19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_view.ml b/test/test_view.ml
index b2d302e..a542419 100644
--- a/test/test_view.ml
+++ b/test/test_view.ml
@@ -292,6 +292,25 @@ let test_vocabularies_localise () =
Alcotest.(check string) "rite_name" "Missale Romanum, editio typica 1962"
(as_str (get [ "rite_name" ] v))
+(* A month answers to BOTH spellings of its own name. The week objects nested
+ inside a month expose [month_name]/[month_num]/[month_abbr], so an author
+ who learned those names there reaches for them one level up too -- and an
+ unknown key renders as the EMPTY STRING by design, so the mistake produced
+ a silently blank heading rather than any error. Found by writing a template
+ from scratch; the shipped ones all sidestep it. *)
+let test_month_answers_to_both_spellings () =
+ let v = view_named 2027 in
+ let jan = List.hd (as_list (get [ "months" ] v)) in
+ let same a b =
+ Alcotest.(check string) (a ^ " = " ^ b) (as_str (get [ a ] jan))
+ (as_str (get [ b ] jan))
+ in
+ same "name" "month_name";
+ same "num" "month_num";
+ Alcotest.(check string) "month_name" "Ianuarius" (as_str (get [ "month_name" ] jan));
+ Alcotest.(check bool) "month_abbr is present and non-empty" true
+ (as_str (get [ "month_abbr" ] jan) <> "")
+
let suite =
( "View",
[ Alcotest.test_case "year shape" `Quick test_year_shape;