aboutsummaryrefslogtreecommitdiff
path: root/internal/caldata/caldata_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/caldata/caldata_test.go')
-rw-r--r--internal/caldata/caldata_test.go114
1 files changed, 95 insertions, 19 deletions
diff --git a/internal/caldata/caldata_test.go b/internal/caldata/caldata_test.go
index 2ba052d..7dbbf84 100644
--- a/internal/caldata/caldata_test.go
+++ b/internal/caldata/caldata_test.go
@@ -246,18 +246,56 @@ func TestTridentineRomanusAndEusebiusPresent(t *testing.T) {
} else if rc.Fields["date"] != "08-09" {
t.Errorf("romanus: date = %q, want 08-09", rc.Fields["date"])
}
- want := map[string]string{
- "eusebius-confessor": "08-14", // "S. Eusebii Conf." -- a Confessor
- "eusebius": "12-16", // "S. Eusebii Ep. et Mart." -- a Bishop and Martyr, a different person
+ want := map[string]struct{ date, rank string }{
+ // St Eusebius Confessor (14 Aug) and St Romanus (9 Aug, checked
+ // above) are both bare "Commemoratio" in the calendarium (no class
+ // of their own) -- pinned here, not just presence/date, per
+ // TestTridentineCommemorationRanksPinned's own reasoning below:
+ // romanus's own rank is pinned there instead, since that test
+ // groups every commemoration-rank entry this task's fixes touched
+ // in one place. eusebius-confessor is listed here because it is
+ // the OTHER half of this specific test's own slug-disambiguation
+ // story.
+ "eusebius-confessor": {"08-14", "commemoration"}, // "S. Eusebii Conf." -- a Confessor
+ "eusebius": {"12-16", "class-3"}, // "S. Eusebii Ep. et Mart." -- a Bishop and Martyr, a different person, unaffected by this round
}
- for slug, date := range want {
+ for slug, w := range want {
rc, ok := l.Cels[slug]
if !ok {
- t.Errorf("missing %q (%s)", slug, date)
+ t.Errorf("missing %q (%s)", slug, w.date)
continue
}
- if rc.Fields["date"] != date {
- t.Errorf("%s: date = %q, want %q", slug, rc.Fields["date"], date)
+ if rc.Fields["date"] != w.date {
+ t.Errorf("%s: date = %q, want %q", slug, rc.Fields["date"], w.date)
+ }
+ if rc.Fields["rank"] != w.rank {
+ t.Errorf("%s: rank = %q, want %q", slug, rc.Fields["rank"], w.rank)
+ }
+ }
+}
+
+// TestTridentineCommemorationRanksPinned: nothing in this test suite
+// asserted `rank` for thomas-becket, silvester, or romanus before this --
+// `TestTridentineRomanusAndEusebiusPresent` above pinned presence and date
+// for romanus but not rank, and Thomas Becket/Silvester (the I3 fix, RG
+// 68(d)/(e)) had no rank assertion anywhere at all. So a future
+// regeneration could silently rewrite any of the three back to class-4 --
+// the EXACT I3 failure mode -- with the suite green throughout. Pinned
+// together because they are the same failure shape (a bare "Commemoratio"
+// in the calendarium, no class of its own, silently promoted by
+// refYearExplainsAbsence's own coupling to temporal_ef.go, see that
+// function's doc comment) even though they were found in two different
+// review rounds (romanus in C2, Thomas Becket/Silvester in I3).
+func TestTridentineCommemorationRanksPinned(t *testing.T) {
+ l := Tridentine()
+ for _, slug := range []string{"romanus", "thomas-becket", "silvester"} {
+ rc, ok := l.Cels[slug]
+ if !ok {
+ t.Errorf("missing %q", slug)
+ continue
+ }
+ if rc.Fields["rank"] != "commemoration" {
+ t.Errorf("%s: rank = %q, want commemoration", slug, rc.Fields["rank"])
}
}
}
@@ -300,24 +338,62 @@ func TestTridentineNoTransferArtifacts(t *testing.T) {
// reaching mobile.Day(date, "ef", version, "pl") -- a shipped dlectio entry
// point -- with no error anywhere in the chain.
//
-// Checks both a broad coverage floor (not exactly 322: a handful of entries
-// added by this same task's own fixes -- St Agnes secundo, St Boniface
-// Martyr, St Evaristus, St Theodore, St Romanus, St Eusebius Confessor --
-// never had a curated Polish name to preserve in the first place, so 322 is
-// not achievable) and one specific, checkable value (the coordinator's own
-// example) so a coverage-only guard cannot itself be satisfied by silently
-// wrong values.
+// CORRECTED after review: the first version of this test counted name.pl
+// only (a hardcoded single language -- the exact "whitelist of two
+// languages" mistake C1's own fix was written to stop repeating, just
+// moved into the test), and its coverage floor (>= 315) had 7 entries of
+// slack -- the review proved dropping 6 entries' Polish names still passed
+// it. Fixed on both axes: the language set is DISCOVERED from the data
+// (every "name.<lang>" key actually present, not a hardcoded list, so a
+// regeneration dropping name.la or introducing a future name.de is
+// checked the same way as name.pl), and the floor for each discovered
+// language is its EXACT true count, not a loose approximation -- verified
+// directly against the branch point (`git show 2386a45:...`) once, by
+// hand, and hardcoded as the answer, not derived at test time from data
+// that could itself be wrong.
+//
+// True counts, independently verified: name.en on every entry (327, all
+// regenerated fresh from missalemeum, including the 5 entries this task's
+// own fixes added); name.pl on exactly 322 (preserved from the branch
+// point; the 5 new entries -- St Agnes secundo, St Boniface Martyr, St
+// Evaristus, St Theodore, St Eusebius Confessor -- never had a curated
+// Polish name to preserve in the first place, so 322, not 327, is the
+// correct target, not a shortfall); no OTHER name.<lang> exists in the
+// branch point at all (name.la is read by the generator but the
+// bootstrapped file has in fact never carried one), so the discovered
+// language set itself must be exactly {en, pl} -- a regeneration that
+// silently introduced or lost an entire language key, not just some
+// values within one, is caught by this assertion, not only by the count.
func TestTridentineNamesPreservedAcrossRegeneration(t *testing.T) {
l := Tridentine()
- n := 0
+ counts := map[string]int{}
for _, rc := range l.Cels {
- if rc.Fields["name.pl"] != "" {
- n++
+ for k, v := range rc.Fields {
+ if v == "" || !strings.HasPrefix(k, "name.") {
+ continue
+ }
+ lang := strings.TrimPrefix(k, "name.")
+ counts[lang]++
}
}
- if n < 315 {
- t.Errorf("name.pl coverage = %d entries, want >= 315 (was 322 before any of this task's fixes; a regeneration must preserve it, not merely not-crash)", n)
+ wantLangs := map[string]bool{"en": true, "pl": true}
+ for lang := range counts {
+ if !wantLangs[lang] {
+ t.Errorf("unexpected name.%s present (%d entries) -- discovered language set must be exactly {en, pl}", lang, counts[lang])
+ }
}
+ for lang := range wantLangs {
+ if counts[lang] == 0 {
+ t.Errorf("name.%s entirely absent -- discovered language set must be exactly {en, pl}", lang)
+ }
+ }
+ if got := counts["en"]; got != len(l.Cels) {
+ t.Errorf("name.en coverage = %d entries, want %d (every entry, all freshly regenerated)", got, len(l.Cels))
+ }
+ if got := counts["pl"]; got != 322 {
+ t.Errorf("name.pl coverage = %d entries, want exactly 322 (the branch point's own true count; the 5 entries this task added have no curated Polish name to preserve, so more or fewer than 322 is a bug either way)", got)
+ }
+
rc, ok := l.Cels["assumption-of-the-blessed-virgin-mary"]
if !ok {
t.Fatal("missing assumption-of-the-blessed-virgin-mary")