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) } // Deuterocanon now present in vul + drb (Clementine Vulgate / Douay-Rheims). if vs, m := Lookup("vul", "Wisdom 3:1"); len(m) != 0 || len(vs) == 0 { t.Errorf("vul Wisdom 3:1: missing=%v verses=%d (deuterocanon should resolve)", m, len(vs)) } if vs, m := Lookup("drb", "Judith 13:22"); len(m) != 0 || len(vs) == 0 { t.Errorf("drb Judith 13:22: missing=%v verses=%d (deuterocanon should resolve)", m, len(vs)) } }