diff options
Diffstat (limited to 'internal/calendar')
| -rw-r--r-- | internal/calendar/oracle_ef_test.go | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/internal/calendar/oracle_ef_test.go b/internal/calendar/oracle_ef_test.go index 7a1b61e..6d63220 100644 --- a/internal/calendar/oracle_ef_test.go +++ b/internal/calendar/oracle_ef_test.go @@ -68,6 +68,14 @@ var efRankNumbers = map[int]calendar.Rank{ // there, not to Time after Epiphany. func efSeasonFromString(s string, month int) calendar.Season { s = strings.ToLower(s) + // missalemeum's own EN-locale text still carries the occasional Latin + // ligature (e.g. "Feria V after Sexagesimæ") -- confirmed in the + // committed snapshot: "Sexagesimæ" appears 10 times, "Sexagesima" (no + // ligature) only 4, and the ligatured form matched no case below, + // silently mapping those 10 days to season "" (skipped from coverage + // entirely, not merely a season miss). Normalising here fixes every + // current and future ligature in one place, not just this one word. + s = strings.ReplaceAll(s, "æ", "ae") has := func(subs ...string) bool { for _, sub := range subs { if strings.Contains(s, sub) { @@ -242,14 +250,22 @@ func TestOracleEF(t *testing.T) { } day, _ := time.Parse("2006-01-02", date) want := efSeasonFromString(src, int(day.Month())) - if want == "" { - skipped++ - continue - } total++ got := calendar.Compute(day.UTC(), sel, layers) - if got.Season != want { + // An unrecognised season phrase skips the SEASON comparison only -- + // it must not also skip Rank/Colour for that day. A `continue` here + // once did exactly that, silently zeroing oracle coverage for every + // day whose phrase efSeasonFromString doesn't recognise (Holy + // Thursday -- "maundy"/"holy week" don't match "Holy Thursday" + // itself; the six September Ember days -- no "ember" case exists at + // all, only Advent/Lent Ember days pass by an incidental substring + // match on "advent"/"lent"). Reverting the Holy Thursday colour fix + // (temporal_ef.go) left this test green under the old `continue`; + // it does not under this one. + if want == "" { + skipped++ + } else if got.Season != want { seasonMiss++ if shownSeason < 40 { t.Errorf("%s: EF season got %q want %q (from %q)", date, got.Season, want, src) @@ -279,6 +295,23 @@ func TestOracleEF(t *testing.T) { break } } + // Membership alone cannot catch a Rose regression: violet is a + // member of every rose/violet pair by construction (Gaudete/ + // Laetare), so "got violet, want one of [rose violet]" passes even + // if RG 131's Rose support (temporal_ef.go) were reverted entirely. + // On the day the rose/violet pair actually names -- oracle rank 1, + // the Sunday itself, not a weekday reusing its propers (which + // carries a lower rank and is deliberately membership-only, this + // file's own doc comment item 3) -- a colour set containing rose + // demands rose specifically, not merely "some member". + if colourOK && od.Rank == 1 && got.Colour != calendar.Rose { + for _, c := range od.Colours { + if c == "p" { + colourOK = false + break + } + } + } if !colourOK && len(od.Colours) > 0 { if ok, reason := efAllowed(date, day, od, "colour"); ok { colourAllowed++ |
