blob: 3a661adc117d05c594bc0cf36aaef1f9a6812e61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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")
}
}
|