diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 12:51:41 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-23 12:51:41 +0200 |
| commit | 0fd209b654b057efa281f86d7bfd5043a12ce407 (patch) | |
| tree | d51224a3ee16b34dbc77eff836ca7cf95dfb1fee /internal/bible/ref_test.go | |
| parent | 998e0d5bb2aa4412ca05d28f27592ae54727e2ba (diff) | |
| download | lectio-0fd209b654b057efa281f86d7bfd5043a12ce407.tar.gz lectio-0fd209b654b057efa281f86d7bfd5043a12ce407.zip | |
bible: reference grammar + Lookup
Diffstat (limited to 'internal/bible/ref_test.go')
| -rw-r--r-- | internal/bible/ref_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/bible/ref_test.go b/internal/bible/ref_test.go new file mode 100644 index 0000000..3a661ad --- /dev/null +++ b/internal/bible/ref_test.go @@ -0,0 +1,31 @@ +package bible + +import "testing" + +func TestSplitRef(t *testing.T) { + got := SplitRef("John 20:1,11-18") + want := []string{"John 20:1", "John 20:11-18"} + if len(got) != 2 || got[0] != want[0] || got[1] != want[1] { + t.Fatalf("SplitRef mixed = %v want %v", got, want) + } + if g := SplitRef("Mat 7:1-5"); len(g) != 1 || g[0] != "Mat 7:1-5" { + t.Errorf("SplitRef contiguous = %v", g) + } +} + +func TestLookup(t *testing.T) { + vs, missing := Lookup("wuj", "John 20:1,11-18") + if len(missing) != 0 { + t.Fatalf("missing = %v", missing) + } + if len(vs) == 0 || vs[0].Verse != 1 { + t.Fatalf("first verse = %+v", vs) + } + last := vs[len(vs)-1] + if last.Verse != 18 { + t.Errorf("last verse = %d want 18", last.Verse) + } + if _, m := Lookup("vul", "Wisdom 3:1"); len(m) == 0 { + t.Error("vul lacks Wisdom; expected a missing entry") + } +} |
