test: add test for search with special characters

Tests searching with dots, colons, hyphens, and parentheses.
Currently fails on SQLite due to FTS5 syntax interpretation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 18:08:55 +01:00
parent 9352fd1f6e
commit d82990fbfa

View File

@@ -266,6 +266,29 @@ func testOptionsSearch(t *testing.T, store Store) {
if len(results) > 2 { if len(results) > 2 {
t.Errorf("Expected at most 2 results, got %d", len(results)) t.Errorf("Expected at most 2 results, got %d", len(results))
} }
// Search with special characters (dots) - should not cause syntax errors
results, err = store.SearchOptions(ctx, rev.ID, "services.nginx", SearchFilters{})
if err != nil {
t.Fatalf("SearchOptions with dots failed: %v", err)
}
if len(results) < 1 {
t.Errorf("Expected at least 1 result for 'services.nginx', got %d", len(results))
}
// Search with other special characters
specialQueries := []string{
"services.nginx.enable",
"nginx:package",
"web-server",
"(nginx)",
}
for _, q := range specialQueries {
_, err = store.SearchOptions(ctx, rev.ID, q, SearchFilters{})
if err != nil {
t.Errorf("SearchOptions with special query %q failed: %v", q, err)
}
}
} }
func testOptionChildren(t *testing.T, store Store) { func testOptionChildren(t *testing.T, store Store) {