diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 12:49:21 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 12:49:21 +0200 |
| commit | 998e0d5bb2aa4412ca05d28f27592ae54727e2ba (patch) | |
| tree | e85f6fa309bd24347c21a1bf0ce555977f6cc4b0 /internal/bible/bible_test.go | |
| parent | 4273441011c9e29c2d7c387fc008d0b7b82f33d8 (diff) | |
| download | lectio-998e0d5bb2aa4412ca05d28f27592ae54727e2ba.tar.gz lectio-998e0d5bb2aa4412ca05d28f27592ae54727e2ba.zip | |
bible: embed corpora + chapter lookup
Diffstat (limited to 'internal/bible/bible_test.go')
| -rw-r--r-- | internal/bible/bible_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/bible/bible_test.go b/internal/bible/bible_test.go new file mode 100644 index 0000000..efd22d6 --- /dev/null +++ b/internal/bible/bible_test.go @@ -0,0 +1,30 @@ +package bible + +import "testing" + +func TestVerses(t *testing.T) { + cases := []struct { + version, book string + chap, verse int + wantPrefix string + }{ + {"wuj", "Genesis", 1, 1, "Na początku stworzył Bóg"}, + {"vul", "Genesis", 1, 1, "In principio creavit Deus"}, + {"drb", "John", 20, 1, "AND on the first day of the week"}, + {"wuj", "Wisdom", 3, 1, "A dusze sprawiedliwych"}, // deuterocanonical + } + for _, c := range cases { + vs := Verses(c.version, c.book, c.chap) + var got string + for _, v := range vs { + if v.Verse == c.verse { + got = v.Text + } + } + if !hasPrefix(got, c.wantPrefix) { + t.Errorf("%s %s %d:%d = %q want prefix %q", c.version, c.book, c.chap, c.verse, got, c.wantPrefix) + } + } +} + +func hasPrefix(s, p string) bool { return len(s) >= len(p) && s[:len(p)] == p } |
