diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-18 09:28:48 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-18 09:28:48 +0300 |
| commit | 96ace6c7019a914e21b25fa94ddfc4ee9239c2fb (patch) | |
| tree | 30550bcab30c91e917a4d8b3feccda829a364437 /internal/llm/copilot_test.go | |
| parent | 6d29ac7e4b2604b5c7df50f33f8ef2357709faf2 (diff) | |
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
Diffstat (limited to 'internal/llm/copilot_test.go')
| -rw-r--r-- | internal/llm/copilot_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
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") } +} + |
