(t *testing.T)
| 166 | } |
| 167 | |
| 168 | func TestRunPerFile_UnknownTool(t *testing.T) { |
| 169 | content := "" |
| 170 | unknownToolResp := &llm.ChatResponse{ |
| 171 | Choices: []llm.Choice{{ |
| 172 | Message: llm.ResponseMessage{ |
| 173 | Content: &content, |
| 174 | ToolCalls: []llm.ToolCall{{ |
| 175 | ID: "call_x", |
| 176 | Type: "function", |
| 177 | Function: llm.FunctionCall{ |
| 178 | Name: "nonexistent_tool", |
| 179 | Arguments: `{}`, |
| 180 | }, |
| 181 | }}, |
| 182 | }, |
| 183 | }}, |
| 184 | Model: "fake", |
| 185 | Usage: &llm.UsageInfo{PromptTokens: 5, CompletionTokens: 5}, |
| 186 | } |
| 187 | client := &fakeClient{responses: []*llm.ChatResponse{unknownToolResp, taskDoneResponse()}} |
| 188 | deps := newTestDeps(client) |
| 189 | runner := NewRunner(deps) |
| 190 | |
| 191 | msgs := []llm.Message{llm.NewTextMessage("user", "review")} |
| 192 | completed, err := runner.RunPerFile(context.Background(), msgs, "main.go") |
| 193 | if err != nil { |
| 194 | t.Fatalf("RunPerFile: %v", err) |
| 195 | } |
| 196 | if !completed { |
| 197 | t.Fatal("expected task_done to complete RunPerFile") |
| 198 | } |
| 199 | if client.calls != 2 { |
| 200 | t.Errorf("expected 2 calls, got %d", client.calls) |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | func TestRunPerFile_MaxToolRequestsWithoutTaskDoneDoesNotComplete(t *testing.T) { |
| 205 | content := "" |
nothing calls this directly
no test coverage detected