(t *testing.T)
| 248 | } |
| 249 | |
| 250 | func TestRunPerFile_UnknownTool(t *testing.T) { |
| 251 | content := "" |
| 252 | unknownToolResp := &llm.ChatResponse{ |
| 253 | Choices: []llm.Choice{{ |
| 254 | Message: llm.ResponseMessage{ |
| 255 | Content: &content, |
| 256 | ToolCalls: []llm.ToolCall{{ |
| 257 | ID: "call_x", |
| 258 | Type: "function", |
| 259 | Function: llm.FunctionCall{ |
| 260 | Name: "nonexistent_tool", |
| 261 | Arguments: `{}`, |
| 262 | }, |
| 263 | }}, |
| 264 | }, |
| 265 | }}, |
| 266 | Model: "fake", |
| 267 | Usage: &llm.UsageInfo{PromptTokens: 5, CompletionTokens: 5}, |
| 268 | } |
| 269 | client := &fakeClient{responses: []*llm.ChatResponse{unknownToolResp, taskDoneResponse()}} |
| 270 | deps := newTestDeps(client) |
| 271 | runner := NewRunner(deps) |
| 272 | |
| 273 | msgs := []llm.Message{llm.NewTextMessage("user", "review")} |
| 274 | completed, _, err := runner.RunPerFile(context.Background(), msgs, "main.go") |
| 275 | if err != nil { |
| 276 | t.Fatalf("RunPerFile: %v", err) |
| 277 | } |
| 278 | if !completed { |
| 279 | t.Fatal("expected task_done to complete RunPerFile") |
| 280 | } |
| 281 | if client.calls != 2 { |
| 282 | t.Errorf("expected 2 calls, got %d", client.calls) |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | func TestRunPerFile_MaxToolRequestsWithoutTaskDoneDoesNotComplete(t *testing.T) { |
| 287 | content := "" |
nothing calls this directly
no test coverage detected