(t *testing.T)
| 273 | } |
| 274 | |
| 275 | func TestRunPerFile_UnknownTool(t *testing.T) { |
| 276 | content := "" |
| 277 | unknownToolResp := &llm.ChatResponse{ |
| 278 | Choices: []llm.Choice{{ |
| 279 | Message: llm.ResponseMessage{ |
| 280 | Content: &content, |
| 281 | ToolCalls: []llm.ToolCall{{ |
| 282 | ID: "call_x", |
| 283 | Type: "function", |
| 284 | Function: llm.FunctionCall{ |
| 285 | Name: "nonexistent_tool", |
| 286 | Arguments: `{}`, |
| 287 | }, |
| 288 | }}, |
| 289 | }, |
| 290 | }}, |
| 291 | Model: "fake", |
| 292 | Usage: &llm.UsageInfo{PromptTokens: 5, CompletionTokens: 5}, |
| 293 | } |
| 294 | client := &fakeClient{responses: []*llm.ChatResponse{unknownToolResp, taskDoneResponse()}} |
| 295 | deps := newTestDeps(client) |
| 296 | runner := NewRunner(deps) |
| 297 | |
| 298 | msgs := []llm.Message{llm.NewTextMessage("user", "review")} |
| 299 | completed, _, err := runner.RunPerFile(context.Background(), msgs, "main.go") |
| 300 | if err != nil { |
| 301 | t.Fatalf("RunPerFile: %v", err) |
| 302 | } |
| 303 | if !completed { |
| 304 | t.Fatal("expected task_done to complete RunPerFile") |
| 305 | } |
| 306 | if client.calls != 2 { |
| 307 | t.Errorf("expected 2 calls, got %d", client.calls) |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | func TestRunPerFile_MaxToolRequestsWithoutTaskDoneDoesNotComplete(t *testing.T) { |
| 312 | content := "" |
nothing calls this directly
no test coverage detected