diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-24 10:47:48 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-24 10:47:48 +0200 |
| commit | e50b003d84b091b60c8028468edc633f04e39731 (patch) | |
| tree | f68b4efc14b133bacd571550d86869aa450cf97d /internal/bible/books_test.go | |
| parent | c9f3bf46f0de09edb796e35f3dcff349febf75c9 (diff) | |
| download | lectio-e50b003d84b091b60c8028468edc633f04e39731.tar.gz lectio-e50b003d84b091b60c8028468edc633f04e39731.zip | |
bible-lookup: add --ref passage lookup + --list-pl/--list-en book lists; v0.6.0
Diffstat (limited to 'internal/bible/books_test.go')
| -rw-r--r-- | internal/bible/books_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/internal/bible/books_test.go b/internal/bible/books_test.go index 43a67cf..e1a65ca 100644 --- a/internal/bible/books_test.go +++ b/internal/bible/books_test.go @@ -24,3 +24,43 @@ func TestResolveBook(t *testing.T) { t.Error("ResolveBook(Nonsense) should fail") } } + +func TestBooksTableIntegrity(t *testing.T) { + if len(canonOrder) != len(aliasSeed) { + t.Fatalf("canonOrder has %d names, aliasSeed has %d", len(canonOrder), len(aliasSeed)) + } + seen := map[string]bool{} + for _, name := range canonOrder { + if seen[name] { + t.Errorf("canonOrder duplicate %q", name) + } + seen[name] = true + a, ok := aliasSeed[name] + if !ok { + t.Errorf("canonOrder name %q missing from aliasSeed", name) + continue + } + if len(a) < 2 { + t.Errorf("book %q has %d aliases, need >=2 (abbrev, pl-name)", name, len(a)) + } + } + for name := range aliasSeed { + if !seen[name] { + t.Errorf("aliasSeed name %q missing from canonOrder", name) + } + } +} + +func TestBooksResolve(t *testing.T) { + for _, b := range Books() { + if b.English == "" || b.Polish == "" || b.Abbrev == "" { + t.Errorf("incomplete BookInfo %+v", b) + } + if c, ok := ResolveBook(b.Abbrev); !ok || c != b.English { + t.Errorf("abbrev %q resolved to (%q,%v), want %q", b.Abbrev, c, ok, b.English) + } + } + if got := len(Books()); got != 73 { + t.Errorf("Books() len = %d, want 73", got) + } +} |
