From d82990fbfafa1a9a0f41bb8af98ecfafa45c6ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 3 Feb 2026 18:08:55 +0100 Subject: [PATCH] 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 --- internal/database/database_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/internal/database/database_test.go b/internal/database/database_test.go index 862e74e..11200cc 100644 --- a/internal/database/database_test.go +++ b/internal/database/database_test.go @@ -266,6 +266,29 @@ func testOptionsSearch(t *testing.T, store Store) { if len(results) > 2 { 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) {