summaryrefslogtreecommitdiff
path: root/internal/lsp/chat_no_double_answer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lsp/chat_no_double_answer_test.go')
-rw-r--r--internal/lsp/chat_no_double_answer_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/lsp/chat_no_double_answer_test.go b/internal/lsp/chat_no_double_answer_test.go
new file mode 100644
index 0000000..9898ad9
--- /dev/null
+++ b/internal/lsp/chat_no_double_answer_test.go
@@ -0,0 +1,22 @@
+package lsp
+
+import (
+ "bytes"
+ "io"
+ "log"
+ "testing"
+)
+
+func TestDetectAndHandleChat_NoDoubleAnswer(t *testing.T) {
+ var out bytes.Buffer
+ s := &Server{logger: log.New(io.Discard, "", 0), docs: make(map[string]*document), out: &out}
+ s.llmClient = fakeLLM{resp: "IGNORED"}
+ uri := "file:///x.go"
+ // Question line with trigger, followed by an existing answer line starting with '>'
+ s.setDocument(uri, "What?>\n> already answered\n")
+ s.detectAndHandleChat(uri)
+ if out.Len() != 0 {
+ t.Fatalf("expected no applyEdit request when answer exists; got %d bytes", out.Len())
+ }
+}
+