aboutsummaryrefslogtreecommitdiff
path: root/internal/readings/readings_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-05 22:24:53 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-05 22:24:53 +0200
commit4855ef2a667b7ea71092e0582db5aff1838a0d63 (patch)
tree098d3a85c503f73d95c551f76e6f9f1d1ef1e208 /internal/readings/readings_test.go
parent8929ab96ad44b707bafd7dfe6f1f7773843c8e85 (diff)
downloadlectio-4855ef2a667b7ea71092e0582db5aff1838a0d63.tar.gz
lectio-4855ef2a667b7ea71092e0582db5aff1838a0d63.zip
calendar/readings: report Sunday as its own display rank, not solemnity
The Ordinary Form's Table of Liturgical Days treats Sunday as its own category, never a solemnity. temporal.go's sundayDay() already marks these days distinctly from named solemnities (Class stays unset, unlike solemn()'s ClassLord); internal/readings/offline.go now reads that existing signal to relabel the REPORTED rank to "sunday" for ordinary and privileged-season Sundays alike, leaving Celebration.Rank, ofRankOrder and all precedence untouched. Named solemnities landing on a Sunday (Easter, Pentecost, ...) and feasts of the Lord (Holy Family) keep reporting their own rank. The 1962 form is untouched. Added calendar.RankSunday (display-only, deliberately excluded from ofRankOrder), the i18n Sunday/niedziela words, and a test pinning the exact dates from the original bug report.
Diffstat (limited to 'internal/readings/readings_test.go')
-rw-r--r--internal/readings/readings_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/readings/readings_test.go b/internal/readings/readings_test.go
index 143b43e..1674d85 100644
--- a/internal/readings/readings_test.go
+++ b/internal/readings/readings_test.go
@@ -99,6 +99,43 @@ func TestLoadModern(t *testing.T) {
}
}
+// TestSundayRankIsDisplayOnly guards the Ordinary Form's Sunday display rank.
+// Sunday is its own category in the 1969 Universal Norms' Table of Liturgical
+// Days -- never a solemnity -- so an ordinary "Nth Sunday of <season>" temporal
+// day (Ordinary Time, Advent, Lent, the Easter season, Christmas time; this
+// also covers Palm Sunday) must report "sunday". A NAMED solemnity of the Lord
+// that happens to fall on a Sunday (Easter Sunday itself, Pentecost) is a
+// genuine solemnity and must keep reporting "solemnity"; a feast of the Lord
+// (Holy Family) must keep reporting "feast". This is display-only: it must
+// never touch the engine's internal precedence, so the 1962 form (which has no
+// such Sunday category -- Sundays report their class exactly as before) is
+// asserted unchanged too. Dates are the ones from the original bug report,
+// plus the Easter/Pentecost/Holy Family dates they imply for the same
+// liturgical year.
+func TestSundayRankIsDisplayOnly(t *testing.T) {
+ cases := []struct {
+ date, lect, wantRank, why string
+ }{
+ {"2026-08-09", "new", "sunday", "19th Sunday in Ordinary Time"},
+ {"2026-11-29", "new", "sunday", "1st Sunday of Advent"},
+ {"2027-03-28", "new", "solemnity", "Easter Sunday itself"},
+ {"2027-05-16", "new", "solemnity", "Pentecost"},
+ {"2026-12-27", "new", "feast", "Holy Family"},
+ {"2026-08-09", "traditional", "class-2", "1962 Sunday after Pentecost"},
+ {"2026-11-29", "traditional", "class-1", "1962 1st Sunday of Advent"},
+ }
+ for _, c := range cases {
+ cfg := config.Config{Lectionary: c.lect}
+ _, info, err := Load(cfg, Options{Date: c.date, All: true})
+ if err != nil {
+ t.Fatalf("%s (%s, %s): Load: %v", c.date, c.lect, c.why, err)
+ }
+ if info.Rank != c.wantRank {
+ t.Errorf("%s (%s, %s): Rank = %q, want %q (name=%q)", c.date, c.lect, c.why, info.Rank, c.wantRank, info.Name)
+ }
+ }
+}
+
// TestLoadTraditional computes the Extraordinary Form day offline: it never
// needs the network, and yields the EF epistle+gospel with a header name.
func TestLoadTraditional(t *testing.T) {