diff options
Diffstat (limited to 'internal/caldata/caldata_test.go')
| -rw-r--r-- | internal/caldata/caldata_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/internal/caldata/caldata_test.go b/internal/caldata/caldata_test.go index 12aed8c..5ffa57e 100644 --- a/internal/caldata/caldata_test.go +++ b/internal/caldata/caldata_test.go @@ -29,3 +29,44 @@ func TestUniversalLoads(t *testing.T) { } } } + +func TestTridentineLoads(t *testing.T) { + l := Tridentine() + if l.ID != "tridentine" { + t.Fatalf("layer id = %q", l.ID) + } + // The full 1962 sanctoral is populated (generated from missalemeum), not the + // 16-entry bootstrap. + if len(l.Cels) < 250 { + t.Fatalf("EF sanctoral has only %d entries; expected the full calendar", len(l.Cels)) + } + // Landmark feasts must be present with the right rank/class: Sts Peter & Paul + // (I class, 06-29), the Purification/Presentation (a II class feast of the + // Lord, 02-02, which must displace a Sunday), the Immaculate Conception + // (I class, 12-08). + want := map[string]struct{ date, rank, class string }{ + "sts-peter-paul": {"06-29", "class-1", ""}, + "purification-of-the-blessed-virgin-mary": {"02-02", "class-2", "lord"}, + "immaculate-conception-of-the-blessed-virgin-mary": {"12-08", "class-1", ""}, + } + for slug, w := range want { + rc, ok := l.Cels[slug] + if !ok { + t.Errorf("missing landmark feast %q", slug) + continue + } + if rc.Fields["date"] != w.date || rc.Fields["rank"] != w.rank { + t.Errorf("%s: date/rank = %q/%q, want %q/%q", slug, rc.Fields["date"], rc.Fields["rank"], w.date, w.rank) + } + if w.class != "" && rc.Fields["class"] != w.class { + t.Errorf("%s: class = %q, want %q", slug, rc.Fields["class"], w.class) + } + } + // every entry must build into a typed Celebration whose rank parsed. + for slug, rc := range l.Cels { + c := calendar.BuildCelebrationForTest(slug, rc) + if c.Rank == calendar.RankFerial && rc.Fields["rank"] != "" { + t.Errorf("%s: rank did not parse (%q)", slug, rc.Fields["rank"]) + } + } +} |
