package bible import "testing" func TestResolveBook(t *testing.T) { cases := []struct{ in, want string }{ {"John", "John"}, {"Joh", "John"}, // English prefix {"J", "John"}, // Polish abbrev — NOT Joshua {"Łk", "Luke"}, {"1 Kor", "1 Corinthians"}, {"Jana", "John"}, {"Rodzaju", "Genesis"}, {"Mdr", "Wisdom"}, {"Pnp", "Song of Solomon"}, {"Dz", "The Acts"}, } for _, c := range cases { if got, ok := ResolveBook(c.in); !ok || got != c.want { t.Errorf("ResolveBook(%q)=%q,%v want %q", c.in, got, ok, c.want) } } if _, ok := ResolveBook("Nonsense"); ok { t.Error("ResolveBook(Nonsense) should fail") } }