Add test for searching for just a colon, for bug fixed in f64e466

This commit is contained in:
David Dworken 2024-11-18 22:10:31 -08:00
parent 7b38f5a5d1
commit eedc401831
No known key found for this signature in database

View File

@ -123,6 +123,14 @@ func TestSearch(t *testing.T) {
if len(results) != 1 { if len(results) != 1 {
t.Fatalf("Search() returned %d results, expected 3, results=%#v", len(results), results) t.Fatalf("Search() returned %d results, expected 3, results=%#v", len(results), results)
} }
// A search for just a plain colon, returns an error but doesn't crash
_, err = Search(ctx, db, ":", 5)
require.Error(t, err)
require.Equal(t, "search query contains malformed search atom ':'", err.Error())
_, err = Search(ctx, db, "foo :", 5)
require.Error(t, err)
require.Equal(t, "search query contains malformed search atom ':'", err.Error())
} }
func TestChunks(t *testing.T) { func TestChunks(t *testing.T) {