summaryrefslogtreecommitdiff
path: root/internal/lsp/completion_messages_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lsp/completion_messages_test.go')
-rw-r--r--internal/lsp/completion_messages_test.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/internal/lsp/completion_messages_test.go b/internal/lsp/completion_messages_test.go
index 28908d5..37d4a8d 100644
--- a/internal/lsp/completion_messages_test.go
+++ b/internal/lsp/completion_messages_test.go
@@ -58,12 +58,16 @@ func TestBuildDocString_Contents(t *testing.T) {
}
}
-func TestBuildPrompts_InParams(t *testing.T) {
- p := CompletionParams{TextDocument: TextDocumentIdentifier{URI: "file:///x"}, Position: Position{Line: 0, Character: 5}}
- sys, user := buildPrompts(true, p, "a", "func f(x)", "c", "func f(x)")
- if !contains(sys, "function signatures") || !contains(user, "parameter list") {
- t.Fatalf("unexpected in-params prompts")
- }
+func TestBuildCompletionMessages_InParams_UsesParamPrompts(t *testing.T) {
+ s := newTestServer()
+ p := CompletionParams{TextDocument: TextDocumentIdentifier{URI: "file:///x"}, Position: Position{Line: 0, Character: 5}}
+ msgs := s.buildCompletionMessages(false, false, "", true, p, "a", "func f(x)", "c", "func f(x)")
+ if len(msgs) < 2 || msgs[0].Role != "system" || msgs[1].Role != "user" {
+ t.Fatalf("unexpected messages")
+ }
+ if !contains(msgs[0].Content, "function signatures") || !contains(msgs[1].Content, "parameter list") {
+ t.Fatalf("unexpected in-params prompts: %#v", msgs)
+ }
}
func TestPostProcessCompletion_CodeFencesAndDuplicates(t *testing.T) {