summaryrefslogtreecommitdiff
path: root/internal/lsp/server_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-10-02 08:41:45 +0300
committerPaul Buetow <paul@buetow.org>2025-10-02 08:41:45 +0300
commite36a5446bc62842ae3b3e165f66fecb7285a8c6a (patch)
treed3f9f7a66d8b4e5fdb13903722580a8f90eae5d1 /internal/lsp/server_test.go
parentf14eb9199f4e1aee49594e590c08996244bb77b3 (diff)
feat: add OpenRouter providerv0.15.0
Diffstat (limited to 'internal/lsp/server_test.go')
-rw-r--r--internal/lsp/server_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/lsp/server_test.go b/internal/lsp/server_test.go
index 4f24b57..836e43f 100644
--- a/internal/lsp/server_test.go
+++ b/internal/lsp/server_test.go
@@ -85,3 +85,20 @@ func TestServerApplyOptions(t *testing.T) {
t.Fatalf("expected config to update, got %d", got)
}
}
+
+func TestServerStoreAndTakePendingCompletion(t *testing.T) {
+ s := newTestServer()
+ items := []CompletionItem{{Label: "foo"}}
+ s.storePendingCompletion("key", items)
+ if len(s.pendingCompletions) != 1 {
+ t.Fatalf("expected pending map to be populated")
+ }
+ items[0].Label = "bar" // ensure copy stored
+ got := s.takePendingCompletion("key")
+ if len(got) != 1 || got[0].Label != "foo" {
+ t.Fatalf("expected preserved copy of completion, got %+v", got)
+ }
+ if len(s.pendingCompletions) != 0 {
+ t.Fatalf("expected pending map to be cleared after take")
+ }
+}