aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/liturgy_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cli/liturgy_test.go')
-rw-r--r--internal/cli/liturgy_test.go31
1 files changed, 26 insertions, 5 deletions
diff --git a/internal/cli/liturgy_test.go b/internal/cli/liturgy_test.go
index 67303f3..88a8b3d 100644
--- a/internal/cli/liturgy_test.go
+++ b/internal/cli/liturgy_test.go
@@ -57,14 +57,35 @@ func TestRunLiturgyTraditionalComputesEF(t *testing.T) {
}
func TestVernacularVersionResolver(t *testing.T) {
- if got := vernacularVersion(config.Config{ReadingVersion: "drb"}); got != "drb" {
- t.Fatalf("explicit: %q", got)
- }
+ // pl has no autoselect-eligible corpus (the built-in Wujek sets
+ // autoselect=false), so Polish always falls back to Latin regardless of
+ // which optional corpora are embedded -- pure logic, keep it running.
if got := vernacularVersion(config.Config{UILanguage: "pl"}); got != "vul" {
t.Fatalf("pl should fall back to Latin: %q", got)
}
- if got := vernacularVersion(config.Config{UILanguage: "en"}); got != "drb" {
- t.Fatalf("en should be drb: %q", got)
+ // Both the explicit reading_version passthrough and the en->drb autoselect
+ // resolve through bible.Meta("drb") (Config.ReadingCorpus), so they need the
+ // optional drb corpus embedded.
+ t.Run("drb", func(t *testing.T) {
+ requireCorpus(t, "drb")
+ if got := vernacularVersion(config.Config{ReadingVersion: "drb"}); got != "drb" {
+ t.Fatalf("explicit: %q", got)
+ }
+ if got := vernacularVersion(config.Config{UILanguage: "en"}); got != "drb" {
+ t.Fatalf("en should be drb: %q", got)
+ }
+ })
+}
+
+// requireCorpus skips the test when corpus `code` is not embedded in this
+// build. The optional corpora (wuj, drb, grb) compile in only with
+// `-tags fullbible` (or when dropped into the user corpora dir); mirrors the
+// helper in internal/bible so these tests run under fullbible and skip -- not
+// fail -- on the default vul-only build.
+func requireCorpus(t *testing.T, code string) {
+ t.Helper()
+ if _, ok := bible.Meta(code); !ok {
+ t.Skipf("corpus %q not embedded; build with -tags fullbible", code)
}
}