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") } }