From 96ace6c7019a914e21b25fa94ddfc4ee9239c2fb Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 18 Aug 2025 09:28:48 +0300 Subject: refactor(lsp,llm,hexailsp,appconfig): split long funcs; add tests - Extract helpers to keep funcs <=50 lines; no behavior changes - Add tests for prompt removal, code actions, and LLM request builders - Table-drive TestInParamList; run gofmt --- internal/llm/copilot_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 internal/llm/copilot_test.go (limited to 'internal/llm/copilot_test.go') diff --git a/internal/llm/copilot_test.go b/internal/llm/copilot_test.go new file mode 100644 index 0000000..5492713 --- /dev/null +++ b/internal/llm/copilot_test.go @@ -0,0 +1,15 @@ +package llm + +import "testing" + +func TestBuildCopilotChatRequest_FieldsAndDefaults(t *testing.T) { + o := Options{Model: "gpt-x", Temperature: 0, MaxTokens: 123, Stop: []string{"X"}} + msgs := []Message{{Role: "user", Content: "q"}} + req := buildCopilotChatRequest(o, msgs, f64p(0.5)) + if req.Model != "gpt-x" { t.Fatalf("model mismatch: %q", req.Model) } + if req.Temperature == nil || *req.Temperature != 0.5 { t.Fatalf("default temp not applied") } + if req.MaxTokens == nil || *req.MaxTokens != 123 { t.Fatalf("max_tokens not applied") } + if len(req.Stop) != 1 || req.Stop[0] != "X" { t.Fatalf("stop not applied") } + if len(req.Messages) != 1 || req.Messages[0].Content != "q" { t.Fatalf("messages not copied") } +} + -- cgit v1.2.3